Tema: codigo tree
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/07/2007, 11:00
Lordztein
 
Fecha de Ingreso: abril-2002
Mensajes: 68
Antigüedad: 23 años
Puntos: 0
codigo tree

Buenas a todos, necesito a alguien que me pueda ayudar con esto.
Yo utilizo el dreamweaver ( que te crea las conexiones etc .. ) y me dieron este codigo para hacer menus en forma de arbol.

Cita:
Set DBConn = Server.CreateObject("ADODB.Connection")
DBConn.Open "DSN=MyDSN"
'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.
DoTree(0,0)
'----------------------------------------------------------
Sub DoTree(ParentID, intLevel)
Dim SQLQ, DBConn, rs, i
SQLQ = "SELECT RecordID, DisplayName FROM RECORDS " & _
"WHERE ParentID = " & ParentID
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 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
End Sub
'------------------------------------------------------------
DBConn.Close
Set DBConn= Nothing
'Once this routine is execute you should see results similiar to this:

Topic 1 RE: Topic 1 RE: RE: Topic 1 RE: RE: Topic 1 RE: Topic 1Topic 2
la cosa esta en que no se que tengo que canviar ya que no quiero nada que defina la conexion ya que ya la tengo definida en la pagina que crea el dreamweaver. Me pueden hacer unas indicaciones en el codigo gracias.
__________________
Lordztein