Paging database results...

Results 1 to 5 of 5

Thread: Paging database results...

  1. #1
    M.Sherman Guest

    Default Paging database results...

    I used the code from ASP101 to page my database results. The only problem is I have a very large database. Sometimes, most of the time I have hundreds and hundreds of pages of results. and they all show up at the bottom of the page:<BR><BR>&#060;&#060;NEXT 1234567........... NEXT&#062;&#062;<BR><BR>How do I limit this to only show maybe 20 pages at the bottom at a time?

  2. #2
    Join Date
    Dec 1969

    Default FAQ's top of this page <eop>


  3. #3
    M. Sherman Guest

    Default Nope, that's not what I need to know

    Nope, that&#039;s not what I need to know.

  4. #4
    Join Date
    Dec 1969

    Default Just write the code...

    You own the ASP code, so just write it the way you want it.<BR><BR>There is surely a loop of some kind that is putting out all those page numbers. Just change the starting and ending points of the loop. Nothing more than that.<BR><BR>You might want to center the loop around the current page or start the loop at the current page or or or.<BR><BR>Let&#039;s say you want to start at the current page plus one and go for no more than 20 pages. Something like this *might* work, depending on the rest of your code:<BR><BR>&#060;%<BR>...<BR>curPage = RS.AbsolutePage<BR>maxPage = RS.PageCount<BR>If maxPage &#062; curPage + 20 Then maxPage = curPage + 20<BR>For pagenum = curPage + 1 To maxPage<BR>&nbsp; &nbsp; Response.Write "&#060;A HREF="thispage.asp?pageNumber=" & pagenum & "...&#062; " & pagenum & " &#060;/A&#062;"<BR>Next<BR>...<BR>%&#062;<BR>

  5. #5
    Join Date
    Dec 1969

    Default If you're using SQL Server...

    and if you&#039;re really returning that many records, you may want to look into using this stored procedure, it will save you massive amounts of server time, and wasted bandwidth.<BR><BR><BR><BR>

Posting Permissions

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