Results 1 to 5 of 5

Thread: Tree View

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Bombay
    Posts
    8

    Question

    Hi,
    I want to pull the node names of the tree view from the database can anyone help me with this.
    kanchan

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    What is the structure of the database that you need to put in a treeview? (ie. Roots,children etc...).

    With a bit more info I might be able to help

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Bombay
    Posts
    8

    Question

    Hi,
    I want to display first node as PROJECT and its child OBJECTS and further its child ATTRIBUTES and these should be editable as these r going to interact with the database.
    Am i clear??????
    Kanchan

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    Bombay
    Posts
    8
    Hi,
    The structure of my database is
    1)Project table
    i)Pro_id
    ii)Pro_desc
    2)Object Table
    i)Object_id
    ii)Object_desc
    iii)Pro_id
    3)Attribute table
    i)attr_id
    ii)attr_desc
    iii)object_id

    i hope i am clear this time
    Kanchan




  5. #5
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    OK,
    Let's try this:
    Code:
    Dim TVX As Node
    Dim tvNode As Nodes
    Dim RST as ADODB.Recordset 'or whatever DB connection type you are using
    
    'Get a record set of the Project table (I assume you can do this
    
    'Populate the treeview with it's parents
    If Not RST.EOF Then
     Do While Not RST.EOF
      Set TVX = tvNode.Add(, , "Parent" & CStr(RST("Pro_id")), RST("Pro_Desc"))
      RST.MoveNext
     Loop
    End IF
    
    RST.Close
    
    'Populate the children of Parents (With Object table)
    'Get a recordset of the object table
    
    If Not RST.EOF Then
     Do While Not RST.EOF
      Set TVX = tvNode.Add("Parent" & Cstr(RST("Pro_id")),tvwChild,"Object" & Cstr(RST("Object_id")),RST("Object_desc"))
      RST.MoveNext
     Loop
    End If
    
    RST.Close
    
    'Populate the children of the Objects (With Attribute table)
    'Get a recordset of the Attribute table
    
    If Not RST.EOF Then
     Do While Not RST.EOF
      Set TVX = tvNode.Add("Object" & Cstr(RST("Object_id")),tvwChild,"Attrib" & Cstr(RST("attr_id"),RST("attr_desc"))
      RST.MoveNext
     Loop
    End If
    
    RST.Close
    
    Set RST = Nothing
    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width