Forums
This topic is locked
Var from Cookie into a SQL query in ASPX
Posted 17 Jan 2006 20:11:00
1
has voted
17 Jan 2006 20:11:00 carel scholtz posted:
I just need to get my cookie value as a variable into my SQL query. That is all. PLEASE can someone help. I just do not seem to get it done. The Cookie in the rest of the code reads in fine and displays, but I cannot get it to work in the SQL statement. Using Dreamweaver. Here is the code. Just the WHERE part of the SQL query? Thanks guys and gals.I KNOW there is some VARs not declared yet. So no need to tell me about that. I just have a problem getting the SQL query working for now. Please. Thanks.
Displaying the cookie AuthenticateGKDUser works fine in the main code, but I need that value in the SQL Query.
-------------------
anguage="C#" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=1.0.0.0,publicKeyToken=836f606ede05d46a,culture=neutral" %>
id="DataSet1"
runat="Server"
IsStoredProcedure="false"
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_STRING_loginaccess"] %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings["MM_CONNECTION_DATABASETYPE_loginaccess"] %>'
CommandText='<%# "SELECT * FROM Users WHERE username = Request.Cookies["AuthenticateGKDUser"]" %>'
Debug="true"
>
<%@ Register TagPrefix="Portal" TagName="ImageCanvas" Src="ImageCanvas.ascx" %>
<%@ import Namespace="System.Drawing" %>
<script runat="server">
void Page_Load(Object sender, EventArgs e) {
HttpCookie UserCookie = Request.Cookies["AuthenticateGKDUser"];
if (null == UserCookie)
{ Response.Write("No cookie"}
else{
String UserCookieValue = UserCookie.Value.ToString();
Response.Write(UserCookieValue);
}
Pen newpen = new Pen(Color.Black);
Pen PartnerPen = new Pen(Color.Blue);
Pen ClientPen = new Pen(Color.Red);
Bitmap bitmap4 = new Bitmap(500,500);
Graphics g4 = Graphics.FromImage(bitmap4);
g4.Clear(Color.White);
g4.DrawLine(newpen,250,250,250,0);
g4.DrawLine(newpen,250,250,367,29);
g4.DrawLine(newpen,250,250,457,110);
g4.DrawLine(newpen,250,250,499,224);
g4.DrawLine(newpen,250,250,482,344);
g4.DrawLine(newpen,250,250,411,442);
g4.DrawLine(newpen,250,250,302,495);
g4.DrawLine(newpen,250,250,181,490);
g4.DrawLine(newpen,250,250,70,424);
g4.DrawLine(newpen,250,250,12,327);
g4.DrawLine(newpen,250,250,3,211);
g4.DrawLine(newpen,250,250,48,103);
g4.DrawLine(newpen,250,250,137,27);
switch(cWork)
{
case 10:
cWorkStrX = 250;
cWorkStrY = 0;
break;
case 9:
cWorkStrX = 250;
cWorkStrY = 25;
break;
case 8:
cWorkStrX = 250;
cWorkStrY = 50;
break;
case 7:
cWorkStrX = 250;
cWorkStrY = 75;
break;
case 6:
cWorkStrX = 250;
cWorkStrY = 100;
break;
case 5:
cWorkStrX = 250;
cWorkStrY = 125;
break;
case 4:
cWorkStrX = 250;
cWorkStrY = 150;
break;
case 3:
cWorkStrX = 250;
cWorkStrY = 175;
break;
case 2:
cWorkStrX = 250;
cWorkStrY = 200;
break;
case 1:
cWorkStrX = 250;
cWorkStrY = 225;
break;
case 0:
cWorkStrX = 250;
cWorkStrY = 250;
break;
}
g4.DrawLine(ClientPen,cWorkStrX,cWorkStrY,cPartnerStrX,cPartnerStrY);
ImageCanvas4.bitmap = bitmap4;
}
</script>
<head>
</head>
<body>
<form runat="server">
</form>
And still more info
</body>