ciao a tutti...il mio problema e questa. Voglio fare la
paginazione dei dati su più pagine. Se devo prendere tutti i dati dal
database funziona tutto bene invece se devo fare una selezione tipo:
<%
Dim code1
code1=Request.Querystring("code")
%>
sql = "SELECT * FROM dati1 WHERE tipo='"&code1&"' ORDER BY " & strOrderBy & " DESC;"
non funziona più...o meglio funziona solo la prima pagina che genera, la seconda mi dice che non ci sono più i dati. Il codice che genera le pagine e questo:
[<%=x%>]
Quando voglio andare nella pagina 2 mi da come risposta:
Nessuna barca presente!
ma questo è un messaggio che deve generare quando non ci sono risultati nel db.
Questo e tutto il codice:
iPageSize = 40
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If
If Request.QueryString("order") = "" Then
strOrderBy = "id"
Else
strOrderBy = Request.QueryString("order")
End If
url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("access_db/barche.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
conn.Open url_DB
Set RS = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM dati1 WHERE tipo='"&code1&"' ORDER BY " & strOrderBy & " DESC;"
RS.Open sql, conn, adOpenKeyset
RS.PageSize = iPageSize
RS.CacheSize = iPageSize
iPageCount = RS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
%><hr>
<p align="center"><font size="2" face="Verdana">Nessuna barca
presente!</font></p>
<hr>
<%
Else
RS.AbsolutePage = iPageCurrent
iRecordsShown = 0
%>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan="4" align="center" class="titolo_news">
<%
response.write("Archivio recensioni " & code1)
%>
</td></tr>
<tr>
<td width="5%" height="40"></td>
<td width="45%" class="testo">Nome</td>
<td width="45%" class="testo"><div align="center">Categoria</div></td>
</tr>
<%
Do While iRecordsShown < iPageSize And Not RS.EOF
%>
<tr>
<td width="5%" height="17">[img]immagini/news.gif[/img]</td>
<td width="45%">" class="menuleft01"><%=RS("nome")%>
<td width="45%" class="testo"><div align="center"><%=RS("categoria")%></div></td>
</tr>
<%
iRecordsShown = iRecordsShown + 1
RS.MoveNext
Loop
%>
</table>
<%
End If
RS.Close
Set RS = Nothing
Conn.Close
%><center>
<%
For x=1 to iPageCount
%>
<font face="Verdana" size="2">[
<%=x%> ]</font>
<%
next
%>
grazie tante

Rispondi quotando