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
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