944,092 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 17184
  • ASP RSS
Aug 1st, 2005
0

ASP paging

Expand Post »
HI ..
any one of you people can help me in asp paging..
Its actually a knowledge base link in which i am displaying the records
based on the filtering we want.it dispalys the records but where to include the paging code...
i got some code from net..
but its not displaying properly....
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
paru is offline Offline
3 posts
since Jul 2005
Aug 1st, 2005
0

Re: ASP paging

inside the loop after the stuff to be shown ie

<% do while recordset <> bof and recordset <> eof

your recordset fields

recordset.movenext (cant remember exact code)#

loop %>
Reputation Points: 10
Solved Threads: 2
Junior Poster
william_stam is offline Offline
131 posts
since Mar 2005
Aug 2nd, 2005
0

Re: ASP paging

No..
See for recordset there are some properties like how many records to be displayed in a single page if we click next it has to show the second page.(that means second set of records)....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
paru is offline Offline
3 posts
since Jul 2005
Aug 11th, 2005
0

Re: ASP paging

This' from an old guest book i wrote.
Not the most stream lined code ever, but should give you an idea....

ASP Syntax (Toggle Plain Text)
  1. <%
  2. Dim adoCon
  3. Dim rsGuestbook
  4. Dim strSQL
  5. Dim adoCon1
  6. Dim strEmail
  7. Dim strSQL1
  8. Dim rsEmail
  9. Dim testv
  10. Dim test1
  11. Dim intRecordspp
  12. Dim intTotalRecords
  13. Dim intTotalPages
  14. Dim intPageNum
  15. Dim strBlah1
  16. Dim strBlah2
  17.  
  18. If Request.QueryString("rpp") = "" Then
  19. intRecordspp = 10
  20. Else
  21. intRecordspp = CInt(Request.QueryString("rpp"))
  22. End If
  23.  
  24. If Request.QueryString("PageNumber") = "" Then
  25. intPageNum = 1
  26. Else
  27. intPageNum = CInt(Request.QueryString("PageNumber"))
  28. End If
  29.  
  30. Set adoCon = Server.CreateObject("ADODB.Connection")
  31. adoCon.Open "Driver={mySQL};......
  32. Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
  33. strSQL = "SELECT Name, Comments, Date_stamp FROM users ORDER BY Date_stamp DESC;"
  34. rsGuestbook.CursorType = 3
  35. rsGuestbook.Open strSQL, adoCon
  36. rsGuestbook.PageSize = intRecordspp
  37.  
  38. If NOT rsGuestbook.EOF Then rsGuestbook.AbsolutePage = intPageNum
  39. intTotalRecords = rsGuestbook.RecordCount
  40. intTotalPages = rsGuestbook.PageCount
  41. %>
  42. <A NAME="top">
  43. <TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 WIDTH="100%">
  44. <TR>
  45. <TD>Guestbook currently holds <B><%=intTotalRecords%></B> comments.<BR><A HREF="addcom.asp">Add comment</A>
  46. <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%">
  47. <TR><TD></TD><TD align="right">Page <%= intPageNum%> of <%= intTotalPages%>
  48. <BR>
  49. <%
  50. If intPageNum = 1 Then
  51. Else %>
  52. <A HREF="gb.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A>
  53. <%
  54. End If
  55. %>
  56.  
  57. <% If intPageNum < intTotalPages Then %>
  58. <A HREF="gb.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A>
  59. <%
  60. Else
  61. End If
  62. %>
  63. </TD></TR></TABLE><p>
  64. <%
  65. for strBlah2 = 1 to intRecordspp
  66. if Not rsGuestbook.EOF Then
  67.  
  68. %>
  69.  
  70. <TABLE WIDTH="100%" CELLPADDING=1 CELLSPACING=0 BORDER=0>
  71. <TR>
  72. <TD CLASS="field">
  73. <TABLE WIDTH="100%" CELLPADDING=2 CELLSPACING=0 BORDER=0>
  74. <TR>
  75. <TD CLASS="border">Comment posted by <B><%= rsGuestbook("Name") %></B></TD>
  76.  
  77. </TR>
  78. <TR>
  79. <TD><BR><%= rsGuestbook("Comments") %><P></TD>
  80. </TR>
  81. <TR>
  82. <TD align=right><%= rsGuestbook("Date_stamp") %></TD>
  83. </TR>
  84. </TABLE>
  85. </TD>
  86. </TR>
  87. </TABLE>
  88.  
  89. <BR>
  90. <%
  91. rsGuestbook.MoveNext
  92. End If
  93. Next
  94.  
  95. 'Reset server objects
  96. rsGuestbook.Close
  97. Set rsGuestbook = Nothing
  98. Set adoCon = Nothing
  99. Set adoCon1 = Nothing
  100. Set rsEmail = Nothing
  101. %>
  102. <P align=right><A HREF="#top">Top</A><BR>&nbsp<BR>
  103. Page <%= intPageNum%> of <%= intTotalPages%>
  104. <BR>
  105. <%
  106. If intPageNum = 1 Then
  107. Else %>
  108. <A HREF="gb.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A>
  109. <%
  110. End If
  111. %>
  112.  
  113. <% If intPageNum < intTotalPages Then %>
  114. <A HREF="gb.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A>
  115. <%
  116. Else
  117. End If
  118. %>
  119.  
Reputation Points: 10
Solved Threads: 5
Junior Poster
madmital is offline Offline
119 posts
since Jun 2005
Sep 23rd, 2006
0

Re: ASP paging

Reputation Points: 58
Solved Threads: 1
Posting Whiz in Training
cancer10 is offline Offline
234 posts
since Dec 2004
Feb 13th, 2007
0

Re: ASP paging

you must declarate
Reputation Points: 10
Solved Threads: 0
Newbie Poster
erpasoleh is offline Offline
2 posts
since Feb 2007
Nov 8th, 2009
0
Re: ASP paging
There is a short but useful article here.. You should look at this:

<URL SNIPPED>Listing Records and ADO Recordset Paging in ASP
Last edited by peter_budo; Nov 16th, 2009 at 4:13 am. Reason: Keep It On The Site - Posts must contain actual content and substance and cannot simply be external links.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
webmstr is offline Offline
2 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Need some help
Next Thread in ASP Forum Timeline: how can i display the ms word document in asp page?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC