Forums
This topic is locked
Need help with cookies
23 Sep 2003 22:56:24 M B posted:
Hello all,It's my first time with using cookies in ASP VBScript. Here's the setup:
I have a sequence of 5 web pages, where page 1 submits information to page 2 and so on. Now, the first 3 pages collect text information and create cookies to store these text values. Pages 4 and 5 are supposed to insert these cookie values into the database using Request.Cookies("name"

Page 4 works fine and inserts information about Workshop (cookies created on page 2 and 3) and Presenter (cookies created on page 4) into their respective tables in an Access database. However, page 5 is where I'm having a problem retrieving the cookie value that was created on page 2.
I have a SQL stmt on page 5 which needs to make use of this cookie value. I have tried Request.Cookie in the SQL stmt and have also tried assigning the cookie value to a variable and then using that variable in the SQL stmt, but to no avail.
Here's an example code:
Dim strID
strID = Request.Cookies("WorkshopTitle"

Dim getWorkID, getWork
getWorkID = "SELECT WorkshopID FROM workshop WHERE workshop_title = '" & strID & "';"
set getWork = Server.CreateObject("ADODB.Recordset"

getWork.ActiveConnection = MM_conference_STRING
getWork.Source = getWorkID
getWork.Open()
Response.Write("WorkID: " & strID)
This stmt returns nothing.
Response.Write(getWork.Fields.Item("WorkshopID"

This stmt returns ADODB error saying it requires a current record.
In a nutshell, I am not able to retrieve cookie value, created on page 2, on page 5.
Any ideas / suggestions ?
Thanks,
J