ho letto un pò nel form e ho presio un esempio su come mettere più recordset in diverse pagine con i numeretti per andare a quella successiva e precedente..
ma la mia select viene fatta con delle variabili e quando passo alla pg succ dice ke nn trova niente..come se nn riuscisse a portare dietro il criteri della ricerca....
se imposto invece una select con criteri fissi funge tutto....
posto un il codice:
-------------------------------------------------------------------------------------
<%
Dim sc, cn, rs, quanti, pag, contatore, titolo,titolo1
cString = ""
cString= cString& "driver={Microsoft Access Driver (*.mdb)};dbq="
cString = cString & Server.MapPath("\database\bcd.mdb")
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")
objConn.Open cString
quanti = 5
pag = Request.QueryString("pag")
If IsNumeric(pag) = False Or pag < 1 Then pag = 1
contatore = 0
reg = replace(request("regioni"),"'", "''")
prov = replace(request("provincie"),"'", "''")
com = replace(request("comuni"),"'", "''")
if prov = "" then
objRs.open "SELECT * from prodotti where macrocat = '" & reg & "' order by prezzopub Asc", objConn,1
else
if com = "" then
set objRs = objConn.Execute("SELECT * from prodotti where macrocat = '" & reg & "' AND sottocat= '" & prov & "' order by prezzopub Asc", objConn,1)
else
set objRs = objConn.Execute("SELECT * from prodotti where macrocat = '" & reg & "' AND sottocat= '" & prov & "' And marca= '" & com & "' order by prezzopub Asc", objConn,1)
end if
end if
if objRs.eof then
response.write "<center>La ricerca non ha prodotto nessun risultato.</center>"
else
objRs.PageSize = quanti
objRs.AbsolutePage = pag
While objrs.EOF = False And contatore < quanti
%>
<table height="50" cellspacing="0" cellpadding="0" width="600"
valign="top" align="center" border=1 bordercolor=white>
<tbody>
<tr>
<%response.write "<td valign=middle align=left width=100 height=80 border=1 bordercolor=black>[img]& objRs([/img]</td>"%>
<td colspan="2" valign="middle" align="center" width="545" height="50">
<%response.write "<font face=arial, verdana color=#336699 size=3>" & objRs("macrocat") & " </font><font face=arial, verdana color=#FF0000 size=2>" & objRs("marca") & " </font>
"%>
<%response.write "[b]<font face=arial, verdana color=#003366 size=1>" & objRs("sottocat") & "</font>"%>
<%response.write "<font face=arial, verdana color=red size=1>" & objRs("codprodotto") & "</font>
"%>
<%response.write "<font face=verdana color=#3399cc size=1>" & objRs("descrizione") & "</font>
"%>
<%response.write "[b]<font face=arial, verdana color=red size=1>Q.tà : " & objRs("quant") & "</font></td>"%>
<%response.write "<td valign=middle align=left width=100 height=80><font face=verdana color=#993300 size=2>" & formatCurrency(objRs("prezzopub")) & "</font></div></td></tr>"%>
<% objrs.MoveNext
contatore = contatore + 1
Wend
end if%>
<p align="center">
<%If pag > 1 Then%>
<font face=arial, verdana color=#336699 size=1>Indietro</font>
<%End If%>
<%
Dim x
x = 1
For x = 1 To objrs.PageCount
If CInt(pag) <> x Then
%>
<font face=arial, verdana color=#336699 size=1><%=x%></font>-
<%
Else
%>
<font face=arial, verdana color=#336699 size=2><%=x%></font>-
<%
End If
Next
%>
<%If objrs.EOF = False Then%>
<font face=arial, verdana color=#336699 size=1>Avanti</font>
<%End If%>
</p>
<%
objRs.Close
Set objRs = Nothing
objConn.Close
Set objConn = Nothing
%>
</tbody>
</table>
P.S ho impostato 5 risulati per pagina..ma me ne mette prima 4 poi le pagine e poi il quinto :berto:

Rispondi quotando
