ciao a tutti mi serve creare un'array con gli id di tutte le sottocategorie di una categoria selezionata, (possono essere al massimo 4 ma anche solo 1) avevo provato in questo modo:

codice:
set cn = Server.CreateObject("ADODB.Connection")
			set rs=Server.CreateObject("ADODB.Recordset")
			cn.Open str_connessione
									
			set rs2=Server.CreateObject("ADODB.Recordset")
			set rs3=Server.CreateObject("ADODB.Recordset")
			set rs4=Server.CreateObject("ADODB.Recordset")
			set rs5=Server.CreateObject("ADODB.Recordset")
			
			if len(request.QueryString("categoria_ricerca"))&empty> 0 then
			
			dim sottocategorie()
						
			set rs2=cn.Execute("select * from categorie where id_categoria=" & request.QueryString("categoria_ricerca"))
			
			cont=0
			do while not rs2.eof
			
			redim sottocategorie(cont+1)
			sottocategorie(cont)=rs2("id")
			cont=cont+1
			
				set rs3=cn.Execute("select * from categorie where id_categoria="& rs2("id"))
				do while not rs3.eof
				
				redim sottocategorie(cont+1)
				sottocategorie(cont)=rs3("id")
				cont=cont+1
					
					set rs4=cn.Execute("select * from categorie where id_categoria="& rs3("id"))
					do while not rs4.eof
					
					redim sottocategorie(cont+1)
					sottocategorie(cont)=rs4("id")
					cont=cont+1
						
						set rs5=cn.Execute("select * from categorie where id_categoria="& rs4("id"))
						do while not rs5.eof
						
						redim sottocategorie(cont+1)
						sottocategorie(cont)=rs5("id")
						cont=cont+1
						
						if rs5.eof=false then rs5.movenext
						loop
						
					if rs4.eof=false then rs4.movenext
					loop
				
				if rs3.eof=false then rs3.movenext
				loop
				
			if rs2.eof=false then rs2.movenext
			loop
			
						
			end if
e non mi da errori di compilazione..

solo che nel momento in cui voglio visualizzare l'array.. (perchè adesso mi vorrei costruire l'array usando come separatori le , cosi da poterlo inserire nella query che pescherà tutte le categorie con quegli id)

usando per esempio
codice:
response.Write(sottocategorie(1))
mi da questo errore:

Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'sottocategorie'

potreste aiutarmi??
grazie 1000