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

Bypassing the BOF EOF Error

Status
Not open for further replies.

jedel

Programmer
Jan 11, 2003
430
AU
Hi all,

I have an ASP that has a list of data in it that displays a snippet of an event with a link to the detailed page. Currently there are no events in the database, which on occasion may be the case for this particular page.

My problem is i get the following error:

Code:
ADODB.Field error '800a0bcd'

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

/creative/index.asp, line 155

Is there a way around this that will allow me to leave this page without any records? Being somewhat of a beginner when it comes to customising this sort of thing, I'd appreciate any help. The code on the page displaying the records is as follows:
Code:
<% 
While ((Repeat1__numRows <> 0) AND (NOT pages.EOF)) 
%>
        <tr>
          <td class="linktext">
		  <%
Dim Mymonth1
Mymonth1 =(events.Fields.Item("Date").Value)
Response.Write Day(Mymonth1)&"-"&MonthName(Month(Mymonth1),true)&"-"&Right(Year(Mymonth1),4)
%>
		  </td>
        </tr>
        <tr>
          <td width="200" class="linktext">
		  <%
Response.Write("<img src='[URL unfurl="true"]http://www.calvarycc.org.au/userfiles/image/church/")[/URL]
Response.Write(events.Fields.Item("Img").Value)
Response.Write("' width= '200' height= '100' border= '0'>")
%>		  </td>
        </tr>
        <tr>
          <td class="linktext"><%=(events.Fields.Item("Short Description").Value)%><br>
            <A HREF="events.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "ComingID=" & events.Fields.Item("ComingID").Value %>">...More&gt;&gt;</A></td>
        </tr>
        <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  pages.MoveNext()
Wend
%>

Thanks in advance

Dean

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
Yes, just be sure to check the EoF property of your recordset objects before attempting to pull a value out of a particular field.

The code above appears to use 2 separate recordsets... one named pages and another named events

The code above will not execute if pages.EoF is True.

However, you will get the error you described if it is possible for pages.EoF to be False while events.EoF is True.


That said, I must wonder why no value from pages is used inside the loop and also why the current record from events is used on each loop iteration... I strongly suspect that the code should only be using one of those two recordsets... and that this is the root of the problem.
 
Sheco,

Thanks, It's great to have a second set of eye on the job. You picked the fault when you highlighted the repeat region was from another recordset. Once I changed this back everything worked.

Cheers

Dean

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top