Allora ci ho provato, penso di aver sbagliato di sicuro...
puoi darci un'occhiata.
Grazie
codice:
<%
SQLCat = " SELECT ID, SCategoria FROM SCategorie ORDER by Scategoria asc "
Set RScat = Conn.Execute(SQLCat)
If Not RSCat.EOF Then
SCatArr = RScat.GetRows
If QSSCategoria <> "" Then
SQLCat = " SELECT ID, Categoria FROM Categorie WHERE SCategoria = " & QSSCategoria
Set RSCat = Conn.Execute(SQLCat)
If Not RSCat.EOF Then
CatArr = RSCat.GetRows
BoolCategorie = True
Else
BoolCategorie = False
End If
RSCat.Close
End If
For Icat = 0 to UBound(SCatArr, 2)
sqlcont = " SELECT COUNT(*) AS TotaleRecord FROM Prodotti WHERE cancellato = false and sCategoria = "&sCatArr(0,ICat)
Set rscont = Conn.Execute(sqlcont)
Rectot = (rscont("TotaleRecord"))
rscont.Close
Set rscont= Nothing
cont=0
while not rs.EOF
con=cont+1
%>
<%if cont=1 & CStr(SCatArr(0,ICat)) = QSSCategoria then%>
<%else%>
<%end if%>
<tr>
<td>
<%
If CStr(SCatArr(0,ICat)) = QSSCategoria Then
If boolCategorie Then
For K = 0 To UBound(CatArr,2)
%>
<%
sqlcontsc = " SELECT COUNT(*) AS TotaleRecord FROM Prodotti WHERE cancellato = false and Categoria = "&CatArr(0,k)
Set rscontsc= Conn.Execute(sqlcontsc)
Rectotsc = (rscontsc("TotaleRecord"))
rscontsc.Close
Set rscontsc = Nothing
%>
<%if CStr(CatArr(0,k)) = QSCategoria then%>
<%if SCategoria <> "" then%>
▪<a href="?scat=<%=SCatArr(0,ICat)%>&cat=<%=CatArr(0,k)%>"><%=CatArr(1,k)%>
(
<%Response.Write rectotsc%>
)
<%end if%>
<%if SCategoria = "" then%>
►<%=CatArr(1,k)%>(
<%Response.Write rectotsc%>
) </a>
<%end if%>
<%
SQLCat = " SELECT * FROM S_Categorie WHERE Categoria = " & CatArr(0,k)
Set RSCat = Conn.Execute(SQLCat)
While Not RSCat.EOF
%>
<%
sqlcontsc2 = " SELECT COUNT(*) AS TotaleRecord FROM Prodotti WHERE cancellato = false and S_Categoria = "&RSCat("ID")
Set rscontsc2= Conn.Execute(sqlcontsc2)
Rectotsc2 = (rscontsc2("TotaleRecord"))
rscontsc2.Close
Set rscontsc2 = Nothing
%>
<%if StrComp(SCategoria, RSCat("ID")) <> 0 then%>
▪"><%=RSCat("S_Categoria")%>
(<%=Rectotsc2%>)
<%end if%>
<%if StrComp(SCategoria, RSCat("ID")) = 0 then%>
►<%=RSCat("S_Categoria")%> (<%=Rectotsc2%>)
<%end if%>
<%
RSCat.MoveNext
Wend
RSCat.close
%>
<%else%>
<%if SCategoria = "" then%>
▪<a href="?scat=<%=SCatArr(0,ICat)%>&cat=<%=CatArr(0,k)%>"><%=CatArr(1,k)%>
(
<%Response.Write rectotsc%>
)</a>
<%end if%>
<%if SCategoria <> "" then%>
▪<a href="?scat=<%=SCatArr(0,ICat)%>&cat=<%=CatArr(0,k)%>"><%=CatArr(1,k)%>
(
<%Response.Write rectotsc%>
)</a>
<%end if%>
<%end if%>
<%
Next
End If
Else
%>
<%=NoCategoria%>
<%
End If
%>
</td>
<%if cont=3 then ' se il contatore ha raggiunto il numero di colonne impostato, chiude la riga%>
</tr>
<%end if%>
<%
'infine controllo il contatore, e se è arrivato a 3 lo azzero, in modo che riparta tutto
if cont=3 then cont=0
rs.movenext
wend
%>
<%
'dopo aver fatto il ciclo, se il contatore è sotto al numero massimo, completo la riga mettendo le celle che mancano e poi chiudo
if cont<3 then
for a=cont to 3
%>
<td></td>
<%
next
'e chiudo questa riga
%>
</tr>
<%
end if
%>
</table>
<td width="10" height="100%">
<table width="1" border="0" cellspacing="0" cellpadding="0" height="100%" bgcolor="#F06600" align="right">
<tr>
<td>
<div align="right"></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="3">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="1">
<tr>
<td bgcolor="#FF6600">[img]Immagini/trasparente.gif[/img]</td>
</tr>
</table>
</td>
</tr>
</table>