Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    [Script ASP] Paginazione Credits Imente

    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>

  2. #2
    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
        %>&lt;&lt; <%
       end if
      %>&lt;
    <%
       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
       %>&gt;
    <%
       if pagina < sk_totalPages - 1 then
        %>&gt;&gt;
    <% 
       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>

  3. #3
    scusami se non ti ho risposto prima, sono stato molto impegnato per alcuni giorni

    sono contento che tu abbia risolto
    san imente saluta

    * http://simonecingano.it *

  4. #4
    Complimenti a te !!!

    PS.: scusa se approfitto, puoi dare un'occhiata qui

    Grazie.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.