<%@ Language=VBScript %> "
<%
Dim Con
Dim rsPage
Dim Page
Dim RowCount
Dim PageCounter
'Get the Current page
Page = Request.QueryString("Page")
'If there is no page set it to page 1
If Page = "" then Page = 1
RowCount = 0
set con = server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
lsSQL = "SELECT Title from Products"
Con.Open "MY-CONNECTION-STRING"
'Need a rich cursor type to support paging
rsPage.CursorType = 3 'adOpenStatic
'Set the number of records in each page to 10
rsPage.PageSize = 10
'Open recordset
rsPage.Open lsSQL, Con
'Set the current page based on the QueryString value
'Must cast it as an integer or else it will have problems.
rsPage.AbsolutePage = cInt(Page)
If Response.IsClientConnected = true then
Response.Write ""
'Loop though each of the records and break out when we
'have reached the max for this page
Do while not rsPage.eof and RowCount < rsPage.PageSize
'Write out content
Response.Write " " " & rsPage("Title") & "
rsPage.Movenext
RowCount = RowCount + 1
Loop
Response.Write "
'Write out links to switch between the pages.
'These just call this page again but with a querystring
'Page to determine the AbsolutePage to display.
For PageCounter = 1 to rsPage.PageCount
Response.Write "" & _
PageCounter & " "
Next
rsPage.Close
set rsPage = Nothing
End if
%>