Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6921257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:15:12+00:00 2026-05-27T10:15:12+00:00

I’m having some trouble with my asp paging. It’s able to show the 6

  • 0

I’m having some trouble with my asp paging. It’s able to show the 6 records on each page. However, when i move on to the second page, it’s showing the same 6 records on every different page.
Below is my code. Any suggestions?

 Dim iPageSize,iPageCount , iPageCurrent , strOrderBy,strSQL,iRecordsShown,I  
    iPageSize = 6
    set registerRS=server.CreateObject("ADODB.recordset")
    registerRS.PageSize = iPageSize
    ' Retrieve page to show or default to 1
    If Request.QueryString("page") = "" Then
        iPageCurrent = 1
    Else
        iPageCurrent = CInt(Request.QueryString("page"))
    End If
    qry="SELECT * FROM "dbo.CustomerOrders;"

    registerRS.CacheSize = iPageSize
    registerRS.open qry,ObjConn,3
    iPageCount = registerRS.PageCount
    If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    If iPageCurrent < 1 Then iPageCurrent = 1
    If iPageCount = 0 Then
        Response.Write "No records found!"
    Else
        registerRS.AbsolutePage = iPageCurrent
    end if
    %>
        <p>
        <font size="+1">Page <strong><%= iPageCurrent %></strong>
        of <strong><%= iPageCount %></strong></font>
        </p>
    <%
    x=registerRS.recordcount
    if registerRS.recordcount > 0 Then
    registerRS.movefirst
    End If
        Do While iRecordsShown < iPageSize And Not registerRS.EOF
                counter=counter+1
                if counter=41 then
                    counter=0
                    counter=counter+1
                end if
                r = r + 1
                If r = 1 then
                    Response.write "<tr>"
                End if
                %>
                   <td>
                        <%=registerRS.Fields("Address")%> <br />>                
                      </td>          
        <%       
            If r = 2 then
            Response.write "</tr>"
            End if
            If r = 3 then r = 1
            ' Increment the number of records we've shown
                iRecordsShown = iRecordsShown + 1
            registerRS.movenext
            loop            
        %>
</table>  
<table width=90%>
    <tr>
        <td>
<%        
    If iPageCurrent > 1 Then        
%>
    <a href="add.asp?page=<%= iPageCurrent - 1 %>&SchoolId=<%=registerRS.Fields("Add")%>">[&lt;&lt; Prev]</a>
<%
    End If
    ' You can also show page numbers:
        For I = 1 To iPageCount
        If I = iPageCurrent Then
%>
<%= I %>
<%Else%>
    <a href="add.asp?page=<%= I %>&SchoolId=<%=registerRS.Fields("Add")%>"><%= I %></a>     
<%
    End If
    Next 'I
    If iPageCurrent < iPageCount Then
%>
    <a href="add.asp?page=<%= iPageCurrent + 1 %>&SchoolId=<%=registerRS.Fields("Add")%>">[Next &gt;&gt;]</a>
<%
    registerRS.close
    set registerRS=nothing 
    End If
    end sub
%>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:15:13+00:00Added an answer on May 27, 2026 at 10:15 am

    Do a view source on the web page and verify that this line of code:

    <a href="add.asp?page=<%= iPageCurrent + 1 %>&SchoolId=<%=registerRS.Fields("Add")%>">[Next &gt;&gt;]</a>
    

    is producing the correct result. If not then you will need to backtrack to find out where the correct page reference is not being generated.

    Compare your code to this example for possible error sources.

    http://www.asp101.com/samples/viewasp.asp?file=db_paging.asp

    I did some testing and I see a couple of things that may be causing problems.

    1] You need to initialize iRecordsShown = 0 before the Do-Loop.

    2] You are also trying to retrieve database values into you links after the loop. This won’t likely work because the loop has already reached the end of records by that time. You’ll need to capture the database values before the end of loop is reached.

    Otherwise it worked for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I want to show the soap response to UIWebview.. my soap response is, <p><img
I'm trying to select an H1 element which is the second-child in its group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.