This' from an old guest book i wrote.
Not the most stream lined code ever, but should give you an idea....
<%
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
%>