Forum Home
Press F1
 
Thread ID: 30873 2003-03-05 12:09:00 ASP Problem, Empty Request sc0ut (2899) Press F1
Post ID Timestamp Content User
125782 2003-03-05 12:09:00 its a comon site
---------------------------------------------------------------------------------------------
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/james' progamming/final/product.asp


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

Page:
GET /james' progamming/final/product.asp
---------------------------------------------------------------------------------------------
i'm getting things from a data base and it displayes them correctly but when there is nothing to display i get this error message

i'm using
<%
do until rsObj2.eof
%>

and also
<%
rsObj2.movenext

loop
%>



do i do sominthing after the loop??
its a basic problem but i cant get my head around it and it'll be faster finding out on a foum
thanks [SKIP SPELL CHEAK SORRY]
sc0ut (2899)
125783 2003-03-05 12:35:00 I'm not actually familiar with ASP but does it have a while loop because it would be better for your purpose. I'm looking at it from a Delphi perspective.
eg.
While not (rsObj2.eof) do
begin
code
code
rsObj2.movenext
end;
It sounds like it must be doing a rsObj2.movenext when it is already on the last record.
mikebartnz (21)
125784 2003-03-06 03:17:00 It's the old story: fetch things until EOF. Trouble is the EOF isn't signalled until after the last "thing" has been fetched, so you often test the EOF only after trying to fetch the last+1 thing. AND THE SYSTEM CHUCKS MESSY ERROR MESSAGES AT YOU X-(. Been there, done that. I've always said that EOF is not an error condition. Any file without an end would be a serious error, in my opinion. :D

Have you got a construct like:

repeat
...
...
until (rsObj2.eof)

(See, I'm a Pascal programmer).

It's just logical. That's the trouble. ;-(
Graham L (2)
125785 2003-03-06 04:34:00 A better solution perhaps, without the rs.EOF clause would be a FOR statement. Using this way gives you a bit of flexibility regarding presenation (eg. different coloured rows for odd/even records)

Some code:
(where rs = your recordset)
------------------------------------

Dim endRecord, currentRecord

endRecord=rs.RecordCount

For currentRecord=1 to endRecord
'Do something

rs.movenext
Next
rs.close()
set rs = Nothing
paintbuoy (3087)
125786 2003-03-06 04:49:00 As mikebartnz says, you would be better to replace the Do Until with a Do While. My ASP experience is limited, but from my experience (RPG), generally, with a Do Until construct, the condition is not checked until the bottom of the loop, wheras with a Do While, the condition is check prior to entering the loop. Thus a Do Until is executed 1 or more times, and a Do While is executed 0 or more times.

Hope that's clearer than it seems. :D

Cheers
Miami
Miami Steve (2128)
125787 2003-03-06 05:20:00 Hrms, I use Do Until DB.EOF and it doesn't get that error, though my DB's aren't empty...

Anyway, I think what you want is "Do While DB.EOF = false". I'm sure I've seen that somewhere, and it works.

And another thing, though not sure if it needs additional code, is:

If RS.BOF And RS.EOF Then
Error_Msg = "<CENTER><FONT face=Tahoma>Login Failed. Try Again. (replace with own message, eg Database is empty. No results were found.</CENTER>"
agent (30)
1