Ciao ragazzi ho dei problemi con la paginazione di record, ho aggiunto al mio script una parte dello script di Roby_72 scaricato dal suo sito, la visualizzazione a video è corretta, quando però clicco su una delle pagine elencate in fondo alla pagina, non appare nulla, questo perchè il valore iPageCount è = 0 ecco lo script:
Graziecodice:<% If Request.QueryString("prodotto") = "" Then Prodotto=request.form("Prodotto") Else Prodotto=Request.QueryString("prodotto") End If Scat=request.form("Scategoria") Scategoria=RIGHT(Scat,2) Categoria=request.form("Categoria") Marca=request.form("Marca") Cprezzo=request.form("Cprezzo") Giacenza=request.form("Giacenza") Offerta=request.form("Offerta") %> <TABLE WIDTH="500" CELLPADDING="0" CELLSPACING="0" BORDER="0" align="center"> <TR height="60" valign="middle"> <TD align="center"> <font face="verdana" size="3" color="red">Paginazione dei risultati di una query</font> </TD> <TR> <TD> <% iPageSize = 20 'NUMERO RECORD PER PAGINA If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = CInt(Request.QueryString("page")) End If ' Inizio If NOT IsNumeric(Scategoria) then Scategoria="%" if Categoria="" then Categoria="%" if Marca="" then Marca="%" if Cprezzo="" then Cprezzo="%" if Offerta="" then Offerta="'%%%'" if Giacenza="" then if Prodotto="" then SQL="select * from Prodotti where Scategoria like '%"&Scategoria&"%' and Categoria like '%"&Categoria&"%' and Marca like '%"&Marca&"%' and cLng(Cprezzo) "&Cprezzo&" and Giacenza like '%%%' and Offerta like "&Offerta&"" Else SQL="select * from Prodotti where (Prodotto like '%"&prodotto&"%' or Grossista like '%"&prodotto&"%' or PDescrizione like '%"&prodotto&"%' or GDescrizione like '%"&prodotto&"%') and Scategoria like '%"&Scategoria&"%' and Categoria like '%"&Categoria&"%' and Marca like '%"&Marca&"%' and cLng(Cprezzo) "&Cprezzo&" and Giacenza like '%%%' and Offerta like "&Offerta&"" End if 'response.write sql 'response.end Else if Prodotto="" then SQL="select * from Prodotti where Scategoria like '%"&Scategoria&"%' and Categoria like '%"&Categoria&"%' and Marca like '%"&Marca&"%' and cLng(Cprezzo) "&Cprezzo&" AND (GiacenzaInfinita OR Giacenza > 0) and Offerta like "&Offerta&"" Else SQL="select * from Prodotti where (Prodotto like '%"&prodotto&"%' or Grossista like '%"&prodotto&"%' or PDescrizione like '%"&prodotto&"%' or GDescrizione like '%"&prodotto&"%') and Scategoria like '%"&Scategoria&"%' and Categoria like '%"&Categoria&"%' and Marca like '%"&Marca&"%' and cLng(Cprezzo) "&Cprezzo&" AND (GiacenzaInfinita OR Giacenza > 0) and Offerta like "&Offerta&"" End If 'response.write sql 'response.end End If ' Fine Set RS = Server.CreateObject("ADODB.Recordset") rs.Open sql,conn,1,3 RS.PageSize = iPageSize RS.CacheSize = iPageSize ' RS.Open strSQL, Conn, adOpenStatic, adLockReadOnly, adCmdText reccount = RS.recordcount iPageCount = RS.PageCount If iPageCurrent > iPageCount Then iPageCurrent = iPageCount If iPageCurrent < 1 Then iPageCurrent = 1 If iPageCount = 0 Then Response.Write " <table><td><font face='verdana' size='2' color='#000000'>Non sono stati trovati giocatori.</td></table></p>" Else RS.AbsolutePage = iPageCurrent iRecordsShown = 0 %> <table cellpadding="0" cellspacing="0" border="0" width="95%"> <tr> <td bgcolor="#cccccc"> <table cellpadding="2" cellspacing="1" border="0" width="100%"> <tr height="22"> <td bgcolor="#dddddd" WIDTH="10%"><font face="verdana" size="2" color="#000000">N.</font></td> <td bgcolor="#dddddd" WIDTH="10%"><font face="verdana" size="2" color="#000000">Giocatore</font></td> <td bgcolor="#dddddd" WIDTH="40%" align="center"><font face="verdana" size="2" color="#000000">Ruolo</font></td> <td bgcolor="#dddddd" WIDTH="20%" align="center"><font face="verdana" size="2" color="#000000">Squadra</font></td> </tr> <% 'SI VISUALIZZA IL CONTENUTO DELLA STRINGA SQL 'ALL'INTERNO DELLA TABELLA PRIMA DEFINITA cont=1 Do While iRecordsShown < iPageSize And Not RS.EOF Dim Rig, bg Rig = Rig + 1 If Rig Mod 2 = 0 then bg = "#E4E4E4" Else bg = "#ccccff" End if Response.Write "<tr bgcolor = " & bg & "><td><font color='#000000' face='Verdana' size='1'>" & RS("Grossista") & "</font></td>" Response.Write "<td><font color='#000000' face='Verdana' size='1'>" & RS("Marca") & "</font></td>" Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & RS("Prodotto") & "</font></td>" Response.Write "<td align='center'><font color='#000000' face='Verdana' size='1'>" & VisualizzaPrezzo(RS("Cprezzo")) & "€ IVA inclusa</font></td>" Cont = Cont + 1 'POSIZIONAMENTO ALLA RIGA SUCCESSIVA DEL DB iRecordsShown = iRecordsShown + 1 RS.MoveNext Loop 'PULIZIA DEGLI OGGETTI ADO RS.Close Set RS = Nothing %> </table> </td> </tr> </table> <%End if%> <%If ipagecount <> 1 Then%> <center> <table> <tr valign="middle"> <td width="50%" align="center" valign="middle"><font face="verdana" size="1" color="#000000"> [ <%if iPageCurrent-2 > 0 and iPageCurrent > 2 then%> <a href="visualizza.asp?page=1>[img]images/first.gif[/img]</a> <%end if%> <%if iPageCurrent > 1 then%> [img]images/pre.gif[/img] <%end if%> <%if iPageCount > 2 then if iPageCurrent-2 < 1 then da_pag = 1 else da_pag = iPageCurrent-2 if iPageCurrent+2 > iPageCount then fino_a_pag = iPageCount else fino_a_pag = iPageCurrent+2 else da_pag = 1 fino_a_pag = iPageCount end if%> <%for i = da_pag to fino_a_pag%> <%if i = iPageCurrent then%> <font color="red"><%=i%></font> <%else%> <%=i%> <%end if%> <%next%> <%if iPageCurrent > 0 and iPageCurrent < iPageCount then%> [img]images/next.gif[/img] <%end if%> <%if iPageCurrent+1 < iPageCount then%> [img]images/last.gif[/img] <%end if%> ] </font></td> </tr> <tr> <td colspan="2" align="center"><font face="verdana" size="1" color="#000000"> <center> Pagina <font color="#FF0000"><%=iPageCurrent%></font> di <font color="#FF0000"><%=iPageCount%></font> </center> </font></td> </tr> </table> </center> <%end if%> </TD> </TR> </TABLE>![]()

Rispondi quotando