Ho un problema con la paginazione dove spesso la paginazione mi fa vedere un'ultima pagina dove però il contenuto è vuoto.
Del tipo avrei 3 pagine piene con i risultati ma invece mi fa vedere la pagina 4, se clicco non mi fa vedere nulla, dato che sempra che il recordset sia arrivato alal fine.
Vi scrivo i codici per la sql che genero:
questo è l'inclide che scrive a video la paginazione (il numero delel pagine insomma)codice:Set brandRS = Server.CreateObject("ADODB.Recordset") ' solo se esiste type if ( Request.QueryString("type") <> "" AND Request.QueryString("tip") = "" AND Request.QueryString("brand") = "" ) then brandRS.open ("SELECT DISTINCT modello, ma, tp, desc, desc_e, stato,prezzo_vendita_usa FROM articoli WHERE type=" & Request.QueryString("type") & " ORDER BY stato DESC") ,connessione ' esiste type e tip elseif (Request.QueryString("type") <> "" AND Request.QueryString("tip") <> "" AND Request.QueryString("brand") = "") then brandRS.open ("SELECT DISTINCT modello, ma, tp, desc, desc_e, stato,prezzo_vendita_usa FROM articoli WHERE tp=""" & Request.QueryString("tip") & """ AND type=" & Request.QueryString("type") & " ORDER BY stato DESC") ,connessione ' esiste type, tip brand e lin , quindi full else brandRS.open ("SELECT DISTINCT modello, ma, tp, desc, desc_e, stato,prezzo_vendita_usa FROM articoli WHERE ma=""" & Request.QueryString("brand") & """ AND tp=""" & Request.QueryString("tip") & """ AND type=" & Request.QueryString("type") & " ORDER BY stato DESC" ) ,connessione end if '------------------------------------------- ' PAGINAZIONE RECORDSET '------------------------------------------- record_x_pagina = 4 num_tot_record = 0 record_da = 0 record_a = 0 while not brandRS.eof num_tot_record = num_tot_record + 1 brandRS.movenext wend if request.querystring("pagina")="" then pagina = 1 else pagina=cint(request.querystring("pagina")) end if num_tot_pagine=round(num_tot_record/record_x_pagina + 0.5) record_da = (pagina-1)*record_x_pagina +1 record_a = record_x_pagina*pagina '-------------------------------- ' FINE PAGINAZIONE '-------------------------------- ' resetto all'inizio il RS brandRS.movefirst ' sposto in avanti il rs start for z=1 to record_da-1 brandRS.movenext next k = 1codice:<div id="pagination"> <% if num_tot_pagine > 1 then str = replace(Request.QueryString(),"pagina=" & Request("pagina") & "&","") %> <%if pagina > 3 and num_tot_pagine > 3 then%> <% if pagina > 3 and num_tot_pagine > 3 then%> First <%end if%> <%end if%> <% for s = pagina-2 to pagina-1 if s > 0 then%><%=s%><%end if next %><span class="showed"><%=pagina%></span> <% for s = pagina+1 to pagina+2 if s<= num_tot_pagine then%><%=s%><%end if next if pagina +2 < num_tot_pagine and num_tot_pagine>3 then%>Last <% end if if pagina +2 < num_tot_pagine then end if Set str = Nothing end if %> </div>
A video per stampare i rpodotti uso questo ciclocodice:while (not brandRS.eof) AND (k <= record_x_pagina) ' e lo faccio finire a fine della pagina [....] k= k + 1 ' incremento il contatore del record if k MOD 2 = 1 then Response.Write("</tr><tr>") end if ' vado a capo con la tabella brandRS.movenext wend

Rispondi quotando