Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disconnected Recordsets

Status
Not open for further replies.

asmith555

Programmer
Oct 7, 2002
97
US
I am trying to return a disconnected recordset to asp from Comm. I keep getting "The connection cannot be used to perform this operation. It is either closed or invalid in this context." The code. The app blows in the ASP Code when I try to acces a recordset method. Someone please help.

VB:
Public Function retrieveCart() As ADODB.Recordset
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = Nothing
rst.CursorLocation = adUseClient
rst.CursorType = adOpenStatic
rst.LockType = adLockBatchOptimistic
rst.Fields.Append "item_serial", adBSTR, 50
rst.Fields.Append "quantity", adInteger
rst.Open
For x = 1 To item_collection.Count
r_item = item_collection.Item(x)
r_qty = qty_collection.Item(x)
rst.AddNew
rst.Fields("item_serial").Value = r_item
rst.Fields("quantity").Value = r_qty
rst.Update
Next x
Set retrieveCart = rst
rst.Close
End Function


ASP:
set sCart = server.CreateObject("storefront.shoppingcart")
sCart.addItem "001001001001", 1
dim rstItems
set rstItems = sCart.retrieveCart()
for x = 1 to rstItems.RecordCount 'Blows up here.
code...
next

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top