If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Recordset Stored in a Session

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-03, 19:02
maxcw maxcw is offline
Registered User
 
Join Date: Oct 2003
Posts: 1
Recordset Stored in a Session

Ok I already know about the overhead, and I dont have access to a DB
Thats why I have been taking this approach. I have an order for that I want to be able to add items one at a time so the cust can add as many as they want.

Eg. The first page the cust enters contact info and their first item. When they submit it loops back around and displays their contact info and first item and lets them add another item. everytime they submit a new item it is added to the list until they finally submit the complete order but thats another story.

I've built the recordset, and I can get it into the session, my problem is pulling it out of the session IIS keeps telling me

The connection cannot be used to perform this operation. It is either closed or invalid in this context.

Line 53.

***** MY CODE FOR THE ITEM RECORDSET AND SESSION*****

If Session("Loaded") = False Then

Set Session("Item") = Server.CreateObject("ADODB.Recordset")

Session("Item").Fields.Append "ItemNumber", adBSTR, 60
Session("Item").Fields.Append "Size", adBSTR, 60
Session("Item").Fields.Append "Quantity", adBSTR, 60
Session("Item").Fields.Append "Description", adBSTR, 60

Session("Item").ActiveConnection = Nothing
Session("Item").CursorLocation = adUseClient
Session("Item").Open
Session("Item").AddNew
Session("Item")("ItemNumber") = Request.Form("ItemNumber")
Session("Item")("Size") = Request.Form("Size")
Session("Item")("Quantity") = Request.Form("Quantity")
Session("Item")("Description") = Request.Form("Description")
Session("Item").Update

Session("Loaded") = True

Do While Session("Item").EOF = false


Response.Write(Session("Item")("ItemNumber") + "<BR>")
Response.Write(Session("Item")("Size") + "<BR>")
Response.Write(Session("Item")("Quantity") + "<BR>")
Response.Write(Session("Item")("Description") + "<BR>")
Session("Item").MoveNext

Loop

Session("Item").Close

Else

Set Item = Session("Item")
Item.ActiveConnection = Nothing
Item.CursorLocation = adUseClient

Line 53. ------->>>>> Item.Open
Item.AddNew
Item("ItemNumber") = Request.Form("ItemNumber")
Item("Size") = Request.Form("Size")
Item("Quantity") = Request.Form("Quantity")
Item("Description") = Request.Form("Description")
Item.Update
Item.Close

Set Session("Item") = Item
Session("Loaded") = True

Do While Item.EOF = false

Response.Write(Item("ItemNumber") + "<BR>")
Response.Write(Item("Size") + "<BR>")
Response.Write(Item("Quantity") + "<BR>")
Response.Write(Item("Description") + "<BR>")
Item.MoveNext

Loop

Item.Close

End If
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On