Sample code for paging through database results N records at a time; and when rs.eof (no record mat

Results 1 to 3 of 3

Thread: Sample code for paging through database results N records at a time; and when rs.eof (no record mat

  1. #1
    Sharon Guest

    Default Sample code for paging through database results N records at a time; and when rs.eof (no record mat

    I am currently trying to author VBScript/ASP code that handles &#039paging through database results N records at a time&#039. (25 results/records on N number of pages; with Next/Prev buttons for page navigation; or serving up all page #&#039s (on each N pages) and making them linkable would work too.<BR><BR>I have found a couple of examples on the web that show this .. for instance:<BR><BR>http://www.geocities.com/SiliconValley/7174/asp/samples/gbpaging.html<BR><BR>However, I have found that when I reproduce the code and write a sql statement that would make rs.eof &#039true&#039 ... that I routinely get the following error message:<BR><BR>-----------------------------------------------------------------<BR>ADODB.Recordset error &#039 800a0bcd&#039 <BR><BR>Either BOF or EOF is True, or the current record has been deleted; the operation requested by the application requires a current record. <BR>----------------------------------------------------------------<BR><BR>Consequently, your assistance in providing any work-arounds and/or pointers to some alternative ways/samples for trying to accomplish this task would be greatly appreciated.<BR><BR>Thanks in advance.<BR><BR>Sincerely,<BR>Sharon

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Sample code for paging through database results N records at a time; and when rs.eof (no record

    Check out the implementation of this on 4Guys:<BR>http://4guysfromrolla.com/webtech/121298-1.shtml<BR><BR>What you need to do is test for rs.EOF. If the condition is true, you don&#039t want to display your records. Does that make sense? One thing you can do is put a big if...else statement<BR><BR>If rs.EOF then<BR>Response.Write("no records returned")<BR>Else<BR>&#039Do all your paging stuff<BR>End If<BR><BR>Have a great day!

  3. #3
    Scott Cate Guest

    Default RE: Sample code for paging through database results N records at a time; and when rs.eof (no record

    I&#039m having this same problem and the BIG if....then doesn&#039t work because the problem is not with an empty rs it&#039s when you cycle through a rs and get to the end.<BR><BR>Everything is working on my page X of Y example. If I return 100 record I get 10 pages with Previous, Next 1..2..3..4..5.....10 working fine. The only problem is the last page gives the ADO error mentioned because for some reasone the EOF is not being detected.<BR><BR>If I strip the paging info and simply list the 100 records EOF is detected and works fine.<BR><BR>If anyone is interested I&#039ll post the code, but only if no one else has a simple solution. It seams that if two of us are experiencing the SAME problem, there is a simple fix.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •