el codigo que me dieron
Código:
<% Call DoTree(0,0) 'here we initially call the sub routine, we pass 0 as the parent ID 'this will pull all top level parent (meaning they don't have an 'ancestor). 'we also pass 0 for the level, this is used for spacing, or 'making the results appear threaded. '---------------------------------------------------------- Sub DoTree(ParentID, intLevel) Set DBConn = Server.CreateObject("ADODB.Connection") DBConn.Open var_cadena_de_conexion Dim SQLQ, DBConn, rs, i SQLQ = "SELECT RecordID, DisplayName FROM RECORDS " & _ "WHERE ParentID = " & ParentID & " ORDER BY DisplayName ASC" Set rs = DBConn.Execute(SQLQ) If Not rs.EOF Then Do Until rs.EOF ' Response.Write "<img src=Spacer.gif Width= " & _ ' 15 * intLevel & ">" Response.Write Replace(Space(intLevel), " ", " ") Response.Write rs("DisplayName") & "<br>" 'now call the subroutine we're in to see if this value has 'any children and increase the indent, and so on... DoTree rs("RecordID"), intLevel + 1 rs.MoveNext Loop End If rs.Close Set rs = Nothing DBConn.Close Set DBConn= Nothing End Sub '------------------------------------------------------------ %>