| | |
ASP paging
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2005
Posts: 107
Reputation:
Solved Threads: 3
This' from an old guest book i wrote.
Not the most stream lined code ever, but should give you an idea....
Not the most stream lined code ever, but should give you an idea....
ASP Syntax (Toggle Plain Text)
<% Dim adoCon Dim rsGuestbook Dim strSQL Dim adoCon1 Dim strEmail Dim strSQL1 Dim rsEmail Dim testv Dim test1 Dim intRecordspp Dim intTotalRecords Dim intTotalPages Dim intPageNum Dim strBlah1 Dim strBlah2 If Request.QueryString("rpp") = "" Then intRecordspp = 10 Else intRecordspp = CInt(Request.QueryString("rpp")) End If If Request.QueryString("PageNumber") = "" Then intPageNum = 1 Else intPageNum = CInt(Request.QueryString("PageNumber")) End If Set adoCon = Server.CreateObject("ADODB.Connection") adoCon.Open "Driver={mySQL};...... Set rsGuestbook = Server.CreateObject("ADODB.Recordset") strSQL = "SELECT Name, Comments, Date_stamp FROM users ORDER BY Date_stamp DESC;" rsGuestbook.CursorType = 3 rsGuestbook.Open strSQL, adoCon rsGuestbook.PageSize = intRecordspp If NOT rsGuestbook.EOF Then rsGuestbook.AbsolutePage = intPageNum intTotalRecords = rsGuestbook.RecordCount intTotalPages = rsGuestbook.PageCount %> <A NAME="top"> <TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 WIDTH="100%"> <TR> <TD>Guestbook currently holds <B><%=intTotalRecords%></B> comments.<BR><A HREF="addcom.asp">Add comment</A> <TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%"> <TR><TD></TD><TD align="right">Page <%= intPageNum%> of <%= intTotalPages%> <BR> <% If intPageNum = 1 Then Else %> <A HREF="gb.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A> <% End If %> <% If intPageNum < intTotalPages Then %> <A HREF="gb.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A> <% Else End If %> </TD></TR></TABLE><p> <% for strBlah2 = 1 to intRecordspp if Not rsGuestbook.EOF Then %> <TABLE WIDTH="100%" CELLPADDING=1 CELLSPACING=0 BORDER=0> <TR> <TD CLASS="field"> <TABLE WIDTH="100%" CELLPADDING=2 CELLSPACING=0 BORDER=0> <TR> <TD CLASS="border">Comment posted by <B><%= rsGuestbook("Name") %></B></TD> </TR> <TR> <TD><BR><%= rsGuestbook("Comments") %><P></TD> </TR> <TR> <TD align=right><%= rsGuestbook("Date_stamp") %></TD> </TR> </TABLE> </TD> </TR> </TABLE> <BR> <% rsGuestbook.MoveNext End If Next 'Reset server objects rsGuestbook.Close Set rsGuestbook = Nothing Set adoCon = Nothing Set adoCon1 = Nothing Set rsEmail = Nothing %> <P align=right><A HREF="#top">Top</A><BR> <BR> Page <%= intPageNum%> of <%= intTotalPages%> <BR> <% If intPageNum = 1 Then Else %> <A HREF="gb.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A> <% End If %> <% If intPageNum < intTotalPages Then %> <A HREF="gb.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A> <% Else End If %>
![]() |
Similar Threads
- paging recordsets with ASP Javascript NOT VB (ASP)
- Prob with ASP (ASP)
- Help (ASP)
Other Threads in the ASP Forum
- Previous Thread: Need some help
- Next Thread: how can i display the ms word document in asp page?
Views: 13580 | Replies: 6
| Thread Tools | Search this Thread |
Tag cloud for ASP
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection calendar changeable connection current database databaseconnection diagnostics dreamweaver excel fso html iis microsoft msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile query record searchbox selectoption server single specfic sqlserver sqlserverconnection toolkit update web webserver windows7





