Problema risolto, a fatica ma risolto... condivido con il forum questa paginazione funzionante
:
codice:
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("../mdb-database/db2.mdb")
If Request.QueryString("pagina") = "" Then
pagina = 1
Else
pagina = CInt(Request.QueryString("pagina"))
End If
count = 0
Set Recordset = Server.CreateObject("ADODB.Recordset")
sSql = "SELECT * FROM Foglio2"
Recordset.Open sSql, conn, 3, 3
if Not Recordset.eof then
'INIZIO INTESTAZIONI TABELLA
Response.write "<div align=center>"
Response.write "<center>"
Response.write "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 style=""border: 1px Solid #6699CC;""><tr><td>"
Response.write "<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2 style=""font-size=11px;font-family:tahoma;"" width=""100%"" BGCOLOR=WHITE>"
Response.Write "<tr bgcolor=#dcdcdc>"
Response.Write "<td align=center>ID</td>"
Response.Write "<td align=center>IP_FROM</td>"
Response.Write "<td align=center>IP_TO</td>"
Response.Write "<td align=center>COUNTRY_CODE2</td>"
Response.Write "<td align=center>COUNTRY_CODE3</td>"
Response.Write "<td align=center>COUNTRY_NAME</td>"
'FINE INTESTAZIONI TABELLA
AnnunciPerPagina = 5
Recordset.PageSize = AnnunciPerPagina
Recordset.AbsolutePage = pagina
For i = 1 to AnnunciPerPagina
if Not Recordset.EOF then
'INIZIO VALORI TABELLA
If count Mod 2 = 0 Then bgclr = "#F6F6F6" Else bgclr = "#EFEFEF" End if
count = count + 1
Response.Write "<tr bgcolor=" & bgclr & ">"
Response.Write "<td align=center>"& Recordset("ID") &"</td>"
Response.Write "<td align=center>"& Recordset("IP_FROM") &"</td>"
Response.Write "<td align=center>"& Recordset("IP_TO") &"</td>"
Response.Write "<td align=center>"& Recordset("COUNTRY_CODE2") &"</td>"
Response.Write "<td align=center>"& Recordset("COUNTRY_CODE3") &"</td>"
Response.Write "<td align=center>"& Recordset("COUNTRY_NAME") &"</td>"
Recordset.MoveNext
end if
Next
Response.Write "</tr>"
Response.Write "</table>"
Response.write "</td></tr></table>
"
Response.write "</td></tr></table>"
'FINE VALORI TABELLA
sk_totalPages = Recordset.PageCount
skBasePage = "paging.asp?"
skBaseAdd = "ag=" & ag
Response.write "<font size=1 color=#000080>"
Response.Write "Numero Pagine:
"
if sk_totalPages > 1 then %>
<body>
[ <%
if pagina > 1 then
if pagina > 2 then
%><< <%
end if
%><
<%
if pagina - 3 > 0 then%><%=pagina-3%>
<% end if
if pagina - 2 > 0 then%><%=pagina-2%>
<% end if
if pagina - 1 > 0 then%><%=pagina-1%>
<% end if
end if
%><%=pagina%>
<%
if pagina < sk_totalPages then
if pagina + 1 < sk_totalPages + 1 then%><%=pagina+1%>
<% end if
if pagina + 2 < sk_totalPages + 1 then%><%=pagina+2%>
<% end if
if pagina + 3 < sk_totalPages + 1 then%><%=pagina+3%>
<% end if
%>>
<%
if pagina < sk_totalPages - 1 then
%>>>
<%
end if
end if
%> ]<%
else
%>1 pagina</p>
</body>
<%
end if
end if
Recordset.Close
Set Recordset = Nothing
Conn.Close
Set Conn = Nothing
%><body></body></html>