<%
Dim strRecordsToShow, CurrentPage, NumPerPage
strRecordsToShow = Request.QueryString("p")
NumPerPage = "15" '# Default
If strRecordsToShow = "" then
NumPerPage = strRecordsToShow
End If
'Retrieve what page we're currently on
If Request.QueryString("page") = "" then
CurrentPage = 1 'We're on the first page
Else
CurrentPage = CInt(Request.QueryString("page"))
End If
mySQL = "SELECT * FROM table_name....."
rs.Open mySQL, conn, 1, 1 'Opened as Read-Only
If Not rs.EOF Then
rs.MoveFirst
rs.PageSize = NumPerPage
TotalPages = rs.PageCount
'Set the absolute (current) page
rs.AbsolutePage = CurrentPage
End If
Dim Count
'Loop to display data on current page.
Do While Not rs.EOF and Count < rs.PageSize
'# Display records here
rs.MoveNext
Count = Count + 1
Loop
rs.close
set conn = nothing
%>
<table width="15%" border="0" cellspacing="0" cellpadding="0" align="right">
<tr>
<td width="42%"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% If Not CurrentPage = 1 Then
Response.Write "<a href='" & "?page=" & CurrentPage - 1 & "'><b>Prev</b></a> | " & "</center>"
Else
Response.Write "Prev | "
End If
%>
</font></td>
<td width="29%"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<% If Not CurrentPage = TotalPages Then
Response.Write "<a href='" & ScriptName & "?page=" & CurrentPage + 1 & "'><b>Next</b></a>"
Else
Response.Write "Next"
End If
%>
</font></td>
</tr>
</table>