bueno, tengo una tabla que tiene 3 campos:
id_categoria : consecutivo autonumerico
categoria : texto, nombre de la categoria ej: "PRODUCTOS"
parentid : numerico, indica a que menu pertenece, si es principal el valor es 0
despues con el siguiente codigo haces el arbol:
Código:
<%
Call DoTree(0,0)
Sub DoTree(ParentID, intLevel)
RSc = Server.MapPath("bd.mdb")
Set conexion = Server.CreateObject("ADODB.Connection")
conexion.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & RSc & ";"
Set RSc = Server.CreateObject("ADODB.Recordset")
if categ<>"" then
en=0
else
en=categ
end if
SQLQ = "SELECT * FROM categorias WHERE ParentID = "&parentid&" ORDER BY categoria ASC"
RSc.Open sqlq, conexion,1,1
If Not rsc.EOF Then
Do while not rsc.EOF
Response.Write Replace(Space(intLevel), " ", " ")
Response.Write "•<a href=agregacat.asp?categ="&rsc("id_categoria")&">"&rsc("categoria")&"</a> <A HREF=borrac.asp?tabla=categorias&id="&rsc("id_categoria")&"></a><br>"
DoTree rsc("id_categoria"), intLevel + 1
rsc.MoveNext
Loop
End If
rsc.Close
Set rsc = Nothing
End Sub
'------------------------------------------------------------
%>
Pruebalo y me comentas si te sirvio