Ciao a tutti.

Ho trovato con la ricerca un codice di paginazione firmato da Imente; non riesco però a farlo funzionare correttamente infatti pur non restituendo errore e muovendosi nella paginazione, fa uno strano gioco con i records nel senso che me li fa sempre vedere tutti (49) e non i 5 che gli chiedo nel codice.

Provatelo qui

Spero che qualcuno mi aiuti a capire dove sto facendo confusione, grazie:

codice:
<html>
 
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
 
<%
 
AnnunciPerPagina = 5
pagina = Request.querystring("pagina")
if pagina="" then pagina= 1
 
 Set Recordset = Server.CreateObject("ADODB.Recordset")
 sSql = "SELECT * FROM myTBL"
 Recordset.Open sSql, conn, 3, 3
 
 Recordset.PageSize = AnnunciPerPagina
 Recordset.AbsolutePage = pagina
 
 if not Recordset.eof then
 
 sk_totalPages = Recordset.PageCount
 sk_currentPage = Recordset.AbsolutePage
 
 skBasePage = "paging.asp?"
 skBaseAdd = "ag=" & ag
 
'DATI NELLE COLONNE
 
Do Until Recordset.Eof
if not Recordset.eof then
 
'DATI NELLE RIGHE
 
Recordset.MoveNext
end if
Loop
 
 

 if sk_totalPages > 1 then %>
<body>
 


[ <%
  if sk_currentPage > 1 then
   if sk_currentPage > 2 then
    %>&lt;&lt;
<%
   end if
  %>&lt;
<%
   if sk_currentPage - 3 > 0 then%><%=sk_currentPage-3%>
<% end if
   if sk_currentPage - 2 > 0 then%><%=sk_currentPage-2%>
<% end if
   if sk_currentPage - 1 > 0 then%><%=sk_currentPage-1%>
<% end if
  end if
  %><%=sk_currentPage%>
<%
  if sk_currentPage < sk_totalPages then
   if sk_currentPage + 1 < sk_totalPages + 1 then%><%=sk_currentPage+1%>
<% end if
   if sk_currentPage + 2 < sk_totalPages + 1 then%><%=sk_currentPage+2%>
<% end if
   if sk_currentPage + 3 < sk_totalPages + 1 then%><%=sk_currentPage+3%>
<% end if
   %>&gt;
<%
   if sk_currentPage < sk_totalPages - 1 then
    %>&gt;&gt;
<% 
   end if
  end if
 %> ]</span><%
 else
 %>1 pagina</p>
 
</body>
<%
 end if
 end if
 
Recordset.Close 
Set Recordset = Nothing
Conn.Close
Set Conn = Nothing
 
%></html>