Originariamente inviato da stewe19
<%
dim ArrCategorie
dim TotaleCategorie
dim IndiceArrCategorie
dim Sql
IndiceArrCategorie=0 'inutile ma chiarifica...
sql="Select * from CATEGORIA" 'order by .... (se ti serve)
aprirs sql
if not rs.eof then 'ovviamente controlli che ci siano delle categorie
TotaleCategorie=rs.recordcount
redim ArrCategorie(TotaleCategorie,2)
do until rs.eof
ArrCategorie(IndiceArrCategorie,0)=rs("ID_CAT")
ArrCategorie(IndiceArrCategorie,1)=rs("CATEGORIA")
IndiceArrCategorie=IndiceArrCategorie+1
rs.movenext
loop
end if
if IndiceArrCategorie>0 then 'controlli se il recordset precedente non era vuoto ed eviti l'errore
for IndiceArrCategorie=0 to TotaleCategorie - 1
sql="SELECT CODICE from PRODOTTO where ID_CAT = " & ArrCategorie(IndiceArrCategorie,0)
aprirs sql
if not rs.eof then 'ovviamente controlli che ci siano delle sottocategorie
response.write "[b]" & ArrCategorie(IndiceArrCategorie,1) & "[b]
"
do until rs.eof
response.write rs("codice") & "
"
rs.movenext
loop
response.write "
"
end if
rs.close
next
end if
%>
scrivendo questo codice mi da questo errore:
Microsoft VBScript runtime error '800a0009'
Subscript out of range: '0'