Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ASP / Database Access / October 2005



Tip: Looking for answers? Try searching our database.

How to suppress "Either BOF or EOF is True" error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kermit Piper - 25 Oct 2005 03:11 GMT
Hello, I have an edit form where the name is already populated. When
the user submits this form, it posts to a process email page which
loops through a separate lookup table. Sometimes the name from the form
will not match the name in the table, which is fine. We don't need to
update the name on the form.

If I don't do this...

if (objRS.BOF and objRS.EOF) then
 response.write "No records found"
 response.end
End if

... I get this:

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

Is there any way to simply suppress this error and let the form just
update, even if there isn't a direct match between the name value from
the form and the name value in the database table?

Thanks in advance,
Bruce
Ray Costanzo [MVP] - 25 Oct 2005 04:01 GMT
I'm not sure what code you want to run, but you don't have to have to put
anything in the condition where it's .EOF.

If Not objRS.EOF Then
   '''your code here.

End If

Ray at work

> Hello, I have an edit form where the name is already populated. When
> the user submits this form, it posts to a process email page which
[quoted text clipped - 20 lines]
> Thanks in advance,
> Bruce
Kermit Piper - 25 Oct 2005 17:46 GMT
If I do what yo suggest, and don't put any response between the
If...End If, I still get this error:
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.

I need to just suppress the error or handle it so it falls through and
continues processing.
Ray Costanzo [MVP] - 25 Oct 2005 18:39 GMT
No, you don't need to supress the error.  You need to not cause errors.

If not yourRS.EOF then
   your code that uses yourRS here.  NOT outside of this if/then block!
End If

Ray at work

> If I do what yo suggest, and don't put any response between the
> If...End If, I still get this error:
[quoted text clipped - 3 lines]
> I need to just suppress the error or handle it so it falls through and
> continues processing.
Mark Schupp - 25 Oct 2005 18:39 GMT
Are you trying to fill in data in the form from the database? You can only
use the recordset if a row is found.

If Not rs.EOF Then
   'get data from recordset
End If
rs.Close

'now fill in the form fields

Signature

--Mark Schupp

> If I do what yo suggest, and don't put any response between the
> If...End If, I still get this error:
[quoted text clipped - 3 lines]
> I need to just suppress the error or handle it so it falls through and
> continues processing.
Roland Hall - 26 Oct 2005 08:42 GMT
: If I do what yo suggest, and don't put any response between the
: If...End If, I still get this error:
[quoted text clipped - 3 lines]
: I need to just suppress the error or handle it so it falls through and
: continues processing.

if not (rs.BOF or rs.EOF) then
 ' records returned
else
 ' no records returned
end if

Signature

Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp

Kermit Piper - 27 Oct 2005 19:37 GMT
What I didn't explain earlier, is that below this code I have a CDONTS
process which is dependent upon the recordset not failing:

<%
               objRS.MoveFirst
    Do While Not objRS.EOF
    For i = 0 to objRS.Fields.Count - 1
    'Response.Write "ID " & objRS.Fields(i).Value
%>

<%
    objCDO.Subject = "IT Help Desk #" & objRS.Fields(i).Value & ", " &
x_Recommendation_Type & ", " & x_System_Type strBody = strBody &
"Request ID: " & objRS.Fields(i).Value
%>

<%
        Next
        objRS.MoveNext
    Loop

    objRS.Close
    set objRS = Nothing
    objConn.Close
    set objConn = Nothing
%>
Bob Barrows [MVP] - 27 Oct 2005 19:48 GMT
> What I didn't explain earlier, is that below this code I have a CDONTS
> process which is dependent upon the recordset not failing:

Then either:

A) Put that process inside the if statement
B) Set a flag variable in your rs check:
dim bRsOK

bRsOK=false
if not objRS.EOF then
   bRsOK = true
   'do the other stuff with the recordset
end if
'later
if bRsOK then
   'do your CDONTS stuff
end if

Bob Barrows
Signature

Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.