<%
Dim Conn
Connect="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("tuo_database.mdb")
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.open Connect
Dim sc, rs, quanti, pag, contatore, est, cn
Set rs = Server.CreateObject("ADODB.Recordset")
quanti = 12
pag = Request.QueryString("pag")
If IsNumeric(pag) = False Or pag < 1 Then pag = 1
contatore = 0
%>
<html>
<head>
<title>Paginazione</title>
<style>a { color: blue; }</style>
</head>
<body>
<div align=center>
<table border="0" cellpadding="4" width="600" cellspacing="1" bgcolor="#DFDFDF">
<%
rs.Open "SELECT * FROM tua_tabella ORDER BY id DESC", conn, 1
rs.PageSize = quanti
rs.AbsolutePage = pag
While rs.EOF = False And contatore < quanti
%>
<tr>
<td><font size="1" face="Verdana"><%=rs("campo1")%></font></td>
<td><font size="1" face="Verdana"><%=rs("campo2")%></font></td>
<td><font size="1" face="Verdana"><%=rs("campo3")%></font></td>
<td><font size="1" face="Verdana"><%=rs("campo4")%></font></td>
</tr>
<%
rs.MoveNext
contatore = contatore + 1
Wend
%>
</table></div>
<p align="center">
<%If pag > 1 Then%>
<font size="1" face="Verdana"> Indietro</font>
<%End If%>
<%
Dim x
x = 1
For x = 1 To rs.PageCount
If CInt(pag) <> x Then
%>
<font size="1" face="Verdana">[
<%=x%>]
<%
Else
%>
<font size="1" face="Verdana"> [
<font size="1" face="Verdana" color=red><%=x%></font>]
<%
End If
Next
%>
<%If rs.EOF = False Then%>
<font size="1" face="Verdana">Avanti</font>
<%End If%>
</p>
</div>
</body>
</html>
<%
rs.Close
Set rs = Nothing
conn.Close
Set cn = Nothing
%>