<html><head>
<title>Paging af et recordset</title>
</head><body>
<%
intPage = Request(\"page\")
If isNumeric(intPage) = False Or intPage < 1 Then
intPage = 1
End If
Set rs = Server.CreateObject(\"ADODB.RecordSet\")
strSQL = \"SELECT LinkURL FROM Links\"
strDSN = \"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=\"&Server.MapPath(\"/aspdigital/db/demo.mdb\")
rs.Open strSQL, strDSN, 1
If Not (rs.BOF Or rs.EOF) Then
rs.PageSize = 10
rs.AbsolutePage = intPage
intRecCount = rs.PageSize
intPageCount = rs.PageCount
Response.Write \"<p><b>Side \" & intPage & \" af \" & intPageCount & \"</b></p>\"
Do While Not rs.EOF And intRecCount > 0
Response.Write rs(\"LinkURL\") & \"<br>\"
intRecCount = intRecCount - 1
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Response.Write \"<p>Gå til side \"
For intNum = 1 To intPageCount
Response.Write \"<a href=paging.asp?page=\" & intNum & \">\" & intNum & \"</a> \"
Next
Response.Write \"<p>\"
If Clng(intPage) > 1 Then
Response.Write \"<a href=paging.asp?page=\" & intPage - 1 & \"><<</a>\"
Else
Response.Write \"<<\"
End If
Response.Write \" \"
If Clng(intPage) < Clng(intPageCount) Then
Response.Write \"<a href=paging.asp?page=\" & intPage + 1 & \">>></a> \"
Else
Response.Write \">>\"
End If
%>
</body></html>
Kan findes her:
http://www.activeserverpages.dk/aspdigital/kapitel2/paging.asp