ASP paging

Reply

Join Date: Jul 2005
Posts: 3
Reputation: paru is an unknown quantity at this point 
Solved Threads: 0
paru paru is offline Offline
Newbie Poster

ASP paging

 
0
  #1
Aug 1st, 2005
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....
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: ASP paging

 
0
  #2
Aug 1st, 2005
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 %>
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 3
Reputation: paru is an unknown quantity at this point 
Solved Threads: 0
paru paru is offline Offline
Newbie Poster

Re: ASP paging

 
0
  #3
Aug 2nd, 2005
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)....
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 107
Reputation: madmital is an unknown quantity at this point 
Solved Threads: 3
madmital madmital is offline Offline
Junior Poster

Re: ASP paging

 
0
  #4
Aug 11th, 2005
This' from an old guest book i wrote.
Not the most stream lined code ever, but should give you an idea....

  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.  
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 234
Reputation: cancer10 is an unknown quantity at this point 
Solved Threads: 0
cancer10's Avatar
cancer10 cancer10 is offline Offline
Posting Whiz in Training
Join Date: Feb 2007
Posts: 2
Reputation: erpasoleh is an unknown quantity at this point 
Solved Threads: 0
erpasoleh erpasoleh is offline Offline
Newbie Poster

Re: ASP paging

 
0
  #6
Feb 13th, 2007
you must declarate
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 2
Reputation: webmstr is an unknown quantity at this point 
Solved Threads: 0
webmstr webmstr is offline Offline
Newbie Poster
 
0
  #7
Nov 8th, 2009
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.
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the ASP Forum


Views: 13580 | Replies: 6
Thread Tools Search this Thread



Tag cloud for ASP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC