<html>
<head>
<title>ASP example</title>
</head>
<body> <%
Dim adoCon
Dim rsProducts
Dim strSQL, TotalRec, RecPerPage
Dim MaxPage,CurPage,CurRec,RowCnt
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
Server.MapPath("northwind.mdb")
Set rsProducts = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT ProductName, QuantityPerUnit, UnitPrice FROM Products ORDER BY
ProductName"
rsProducts.Open strSQL, adoCon, 1
TotalRec=rsProducts.RecordCount
RecPerPage=10
MaxPage=int(TotalRec/RecPerpage)+1
CurPage=CInt(Request.QueryString("page"))
if CurPage<1 then CurPage=1
if CurPage>MaxPage then Curpage=MaxPage
CurRec=(CurPage-1)*RecPerPage
%>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th>Product Name</th>
<th>Quantity Per Unit</th>
<th>Unit Price</th>
</tr> <%
RowCnt=0
rsProducts.Move CurRec
Do While not rsProducts.EOF and RowCnt<10
%>
<tr>
<td><%Response.Write (rsProducts("ProductName"))%></td>
<td><%Response.Write (rsProducts("QuantityPerUnit"))%></td>
<td><%Response.Write (rsProducts("UnitPrice"))%></td>
</tr> <%
rsProducts.MoveNext
RowCnt=RowCnt+1
Loop
%>
</table> <%
if CurPage<>1 then
Response.Write ("<a href='nwind.asp?page=" & CurPage-1 & "'>Previous page</a> ")
end if
if CurPage<>MaxPage then
Response.Write (" <a href='nwind.asp?page=" & CurPage+1 & "'>Next page</a>")
end if
%>
</body>
</html>