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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GetRows() and empty Recordsets 1

Status
Not open for further replies.

reisende

Programmer
Mar 16, 2004
74
US
Hello everyone.

I am trying to use GetRows on a recordset that will display the contents of a shopping cart. It works fine if the recordset (cart) is not empty, but when there is nothing in the shopping cart I get this:

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

How do I code this so instead of this error I can get my "Sorry, your cart is empty" message?

Thanks.
 
guessing ( since you didn't post any code )

your code is along these lines : ( red lines would be the additions to help resolve the issue )

Create connection
connection.open wahtever
using session/cookie id, fetch recordset [RS] for said cart.
Open RS / Execute
[red] IF not RS.EOF AND not RS.BOF then[/red]
GetRows
Kill RS
Kill Connection

Do while whatever
Output
Loop
kill Array
[red]ELSE
Kill RS
Kill Connection
Response.Write "Danger! Will Robinson, Danger!" (empty cart error / output )
END If
[/red]


[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Sorry about that. My brain is pretty fried right now.

Here is some of what I have:

Code:
strSQL = "SELECT ROW_ID, CAT_ID, ITEM_ID, PREMPL, TITLE, QUANTITY, PRICE, DEDUCT_COUNT, ITEM_NAME FROM MO_CART_ROWS r, MO_ITEMS i WHERE (r.ITEM_ID = i.ITEM_ID) AND r.SESSION_ID = '" & userSession & "' AND r.ORDER_NUMBER IS NULL ORDER BY r.ROW_ID;"
  call getFromDatabase("coranet", strSQL, rsTemp, "view_cart")
  arrCartRows = rsTemp.GetRows()
  rsTemp.Close
  set rsTemp = nothing
 
as noted above, just insert the red lines or derivations of them in the rough logical positions in the code, should patch you right up.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
OK, now that I've had time to restore some brain function it all makes perfect sense :)

Thanks, Robert.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top