Ciao devilfree,
mah ... non sono convinto ...

mi sembra troppo semplice ... mi sfugge qualcosa?
... intanto prova come di seguito e vediamo come mi prendi a pernacchie

...!
Fammi sapere, ciao.
Umb
<%
If (QSSCategoria = "") AND (QSCategoria = "") AND (QSQuery = "") Then
Response.Redirect Request.ServerVariables("HTTP_REFERER")
Else
'---Stampo a video i prodotti delle categorie richieste
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.PageSize = MaxProdottiPerPagina
If QSQuery <> "" Then
QSQuery = Replace(QSQuery, "'", "''")
ArrQuery = Split(QSQuery, " ")
SQL = " SELECT * FROM Prodotti WHERE "
For i = 0 to UBound(ArrQuery, 1)
SQL = SQL & "(Prodotto LIKE '%" & ArrQuery(i) & "%' OR PDescrizione LIKE '%" & ArrQuery(i) & "%' OR GDescrizione LIKE '%" & ArrQuery(i) & "%') AND "
Next
SQL = SQL & "Cancellato = False AND Giacenza > 0 "
RS.Open SQL, Conn, 1
Else
If (QSCategoria = "") Then
SQL = " SELECT * FROM Prodotti WHERE SCategoria = "& [QSSCategoria] &" AND Categoria = 0 AND Cancellato = False AND Giacenza > 0 "
RS.Open SQL, Conn, 1
End If
If (QSCategoria <> "") Then
SQL = " SELECT * FROM Prodotti WHERE Categoria = "& [QSCategoria] &" AND Cancellato = False AND Giacenza > 0"
RS.Open SQL, Conn, 1
End If
End If
If Not RS.EoF Then
RS.MoveFirst
RS.AbsolutePage = QSPg
If QSPg <> 1 Then
Footer = "<a href=""catalogo.asp?scat=" & QSSCategoria & "&cat=" & QSCategoria & "&pg=1&q=" & QSQuery & """>" & PrimaPagina & "</a> "
Else
Footer = PrimaPagina & " "
End If
For I = 1 To RS.PageCount
If I = QSPg Then
Footer = Footer & I & " "
Else
Footer = Footer & "<a href=""catalogo.asp?scat="&QSSCategoria&"&cat="&QSCategoria&"&pg="&i&"&q=" & QSQuery & """>"& I &"</a> "
End If
Next
If QSPg <> RS.PageCount Then
Footer = Footer & "<a href=""catalogo.asp?scat="&QSSCategoria&"&cat="&QSCategoria&"&pg="&RS.PageCount&"&q=" & QSQuery & """>" & UltimaPagina & "</a>"
Else
Footer = Footer & UltimaPagina
End If
For I = 1 To RS.PageSize
If RS.EOF Then Exit For
%>