Ciao a tutti,
non so se devo postare qui, in Database o ASP.
Il fatto è questo,
io ho prelevato un menù MegaDropdown e vorrei farlo interfacciare con SQL, in modo che le voci del menù e sotto meù, con i relativi collegamenti, li prenda in automatico.
Sinceramente nn sono capace, ci ho provato ma senza riuscirci....
Io un menù generico che preleva le infomazioni dal DB già ce l'ho ed è questo:
codice:
<table width="150" cellspacing="0" cellpadding="3" bordercolordark="#E5E5E5" bordercolorlight="#000000" border="0" style="border-left: 0px dotted #C0C0C0; border-right: 1px dotted #C0C0C0; border-bottom: 1px dotted #C0C0C0; border-top-color:#C0C0C0; border-top-width:0px">
<tr>
<td valign="top" bgcolor="<%=Tabella_Colore_Cella%>" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium">
<%
Dim SQLCat, RSCat, Icat, QSSCategoria, SCatArr, CatArr, BoolCategorie, K
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)%>
<div align="left">
<table id="demo" class="ruler" cellpadding="5" style="border:1px solid #FFFFFF; " width="100%">
<tr>
<td>
<%
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
%><%if CStr(SCatArr(0,ICat)) = QSSCategoria then%>
<%if QSCategoria <> "" then %>
■ <%=SCatArr(1,ICat)%> (<%Response.Write rectot%>)
<%end if%>
<%if QSCategoria = "" then %>
► <%=SCatArr(1,ICat)%> (<%Response.Write rectot%>)
<%end if%>
<%else%>
■ <%=SCatArr(1,ICat)%> (<%Response.Write rectot%>)
<%end if%>
</td>
</tr>
</table>
<%
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%>
▪<%=CatArr(1,k)%> (<%Response.Write rectotsc%>)
<%end if%>
<%if SCategoria = "" then%>
►<%=CatArr(1,k)%>(<%Response.Write rectotsc%>)
<%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%>
▪<%=CatArr(1,k)%> (<%Response.Write rectotsc%>)
<%end if%>
<%if SCategoria <> "" then%>
▪<%=CatArr(1,k)%> (<%Response.Write rectotsc%>)
<%end if%>
<%end if%>
<%
Next
End If
End If
Next
Else
%>
<%=NoCategoria%>
<%
End If
%>
</td>
</tr>
</table>
grazie