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

Either BOF or EOF is True, when paging

Status
Not open for further replies.

welshone

Programmer
Jul 30, 2001
414
GB
Hello,
I have found some info. on paging, but when I click on the button to scroll to the next set of records I get the following message :

ADODB.Recordset error '800a0bcd'

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

/holdingdbv2/searchresultsschool.asp, line 38

line 38 is RS.AbsolutePage = PageNo.

does anybody have any suggestions ?

cheers.
Jamie
 
CHeck you are connecting to the correct table in the database (check the name of it).

You could try a movefirst command to make sure another process hasn't left your pointer at the end of the table.
 
This is my asp page.
The first connection / recordset is what I want to page.
When it first loads I get the data, it is when I want to go to the next page is when the error appears ....

<%
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4


Dim module

module = Request.Form(&quot;module&quot;)


Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set RS = Server.CreateObject(&quot;ADODB.RecordSet&quot;)
Conn.Open &quot;Holding&quot;,&quot;edholding&quot;,&quot;edholding&quot;
sql = &quot;SELECT [RepGenA].[filename], [RepGenA].[UPN], [RepGenA].[Forename], [RepGenA].[surname],[RepGenA].[DOB] FROM RepGenA WHERE SUBSTRING(RepGenA.filename,4,4) = '&quot;&module&&quot;' AND DateofLeaving = '' &quot;
RS.Open sql, Conn, adOpenKeyset,adLockReadOnly
TotalRows=RS.RecordCount
RS.PageSize = 10' Number of rows per page
PageSize=RS.PageSize
if Request(&quot;Action&quot;) = &quot;&quot; Then
FormAction = &quot; searchresultsschool.asp&quot; 'NOTE This is the name of the current form.
end if
ScrollAction = Request(&quot;ScrollAction&quot;)
if ScrollAction <> &quot;&quot; Then
'Create Page Information
PageNo = mid(ScrollAction, 5)
if PageNo<1 Then
PageNo = 1
end if
else
PageNo = 1
end if
RS.AbsolutePage = PageNo
PageNumber=PageNo
TotalPages=RS.PageCount
%>



<html>
<head>
<title>Holding Database</title>
</head>


<BODY>


<%

if rs.eof then
Response.Write &quot;No Records found, Please choose again.&quot;
else
%>

<%
Dim SearchTextcompany, MyConncompany, SQLcompany, RScompany

Set MyConncompany=Server.CreateObject(&quot;ADODB.Connection&quot;)
MyConncompany.Open &quot;schoolsasp&quot;,&quot;schoolsasp&quot;,&quot;schoolsasp&quot;

SQLcompany = &quot;SELECT EstablishmentID, DfEE, EstablishmentName From Establishments WHERE DfEE = '&quot;&module&&quot;' ORDER BY EstablishmentName&quot;

Set RScompany = MyConncompany.Execute(SQLcompany)
%>
<center>
<p BGCOLOR=#C7CFFD BORDERCOLOR=#000000 nowrap><FONT SIZE=+1 FACE=&quot;Arial&quot; COLOR=#000000>Pupils in <%=Server.HTMLEncode(rscompany.Fields(&quot;EstablishmentName&quot;).Value)%> </FONT></p>
<%
RScompany.Close
MyConncompany.Close
Set RScompany = Nothing
Set MyConncompany = Nothing
%>

<FORM METHOD=POST ACTION=&quot;<%=FormAction%>&quot; id=form2 name=form2>
<%Do while not (RS is nothing) %>
<TABLE BORDER=1>
<TR>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000 nowrap><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000>UPN</FONT></TH>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000 nowrap><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000>Forename</FONT></TH>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000>Surname</FONT></TH>
<TH BGCOLOR=lightblue BORDERCOLOR=#000000><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000>Date of Birth</FONT></TH>

</TR>
<%RowCount = rs.PageSize
Do While Not RS.EOF and rowcount>0%>

<TR VALIGN=TOP onMouseover=&quot;changeto('yellow')&quot;
onMouseout=&quot;changeback('white')&quot;>
<a href=&quot;./moredetails.asp?G_id=<%=Server.HTMLEncode(rs.Fields(&quot;upn&quot;).Value)%>&quot;>

<TD BORDERCOLOR=#c0c0c0 nowrap><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000><%=RS(&quot;UPN&quot;)%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0 nowrap><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000><%=RS(&quot;Forename&quot;)%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000><%=RS(&quot;Surname&quot;)%><BR></FONT></TD>
<TD BORDERCOLOR=#c0c0c0><FONT SIZE=2 FACE=&quot;Arial&quot; COLOR=#000000><%=RS(&quot;DOB&quot;)%><BR></FONT></TD>
</TD></a>

</TR>
<%RowCount=RowCount-1
'Now we move to the next record in the recordset
RS.MoveNext
Loop%>
<P>
<%
'Now we set the result to the next recordset
set RS=RS.NextRecordSet
Loop
'Finally we close the connnection
Conn.Close
set RS=nothing
set Conn=nothing%>
</TABLE>
<INPUT TYPE=&quot;HIDDEN&quot; NAME=&quot;sql&quot; VALUE=&quot;<%=sql%>&quot;>
<%if PageNo>1 Then
'This code is for the button to go to the previous result, as you can see it starts when pageno=1, this is because on page 0 with the first 5 records, there is no previous result
%>
<INPUT TYPE=&quot;SUBMIT&quot; NAME=&quot;ScrollAction&quot; VALUE=&quot;<%=&quot;Page &quot; & PageNo-1%>&quot;>
<%end if %>

<%'The following code is for the button to go the next result
if PageNo<TotalPages or (PageNo=1 and totalpages>1) Then %>
<INPUT TYPE=&quot;SUBMIT&quot; NAME=&quot;ScrollAction&quot; VALUE=&quot;<%=&quot;Page &quot; & PageNo+1%>&quot;>
<%end if %>
</FORM>



</body>
</html>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top