Add a child node to a tree in vb.net

I need to bind datype to dacontent by the lngIntakeID and then display it under node prod the structure should be
>Create new client Contact
>Date
  --->   intake date- staff - dob  
         ----->  data for that intake

I can get the queries to work but I'm not sure how to modify the code to get the node type tolink.  Thanks
Dim daSections As New SqlDataAdapter("SELECT DISTINCT TOP 100 PERCENT convert(varchar(10),dbo.tblMHCIntake.dtmIntake,101) as intakedate,dtmintake, DATENAME(dw, dbo.tblMHCIntake.dtmIntake) AS dayname FROM         dbo.tblMHCIntake   where dtmintake > '01/01/2008'ORDER BY dbo.tblMHCIntake.dtmIntake DESC", Connection1)
        Dim daContent As New SqlDataAdapter("SELECT DISTINCT TOP 100 PERCENT tblPatient.strLName + ', ' + tblPatient.strFName AS name, CONVERT(varchar(10), tblMHCIntake.dtmIntake, 101) AS intakedate, tblMHCIntake.dtmIntake, tblMHCIntake.strStaff, CONVERT(varchar(10), tblPatient.dtmDOB, 101) AS dtmdob, tblPatient.strPatientId, tblMHCIntakeDetail.lngIntakeId FROM tblMHCIntake INNER JOIN tblMHCIntakeDetail ON tblMHCIntake.lngIntakeId = tblMHCIntakeDetail.lngIntakeId INNER JOIN tblLUMHCData ON tblMHCIntakeDetail.lngDataId = tblLUMHCData.lngDataID RIGHT OUTER JOIN tblPatient ON tblMHCIntake.lngPatientId = tblPatient.lngPatientId WHERE (tblMHCIntake.dtmIntake > '1/1/2008')ORDER BY tblMHCIntake.dtmIntake DESC", Connection1)
               Dim datype As New SqlDataAdapter("SELECT DISTINCT TOP 100 PERCENT tblMHCIntakeDetail.lngIntakeId , tblMHCIntakeDetail.lngDataId, tblLUMHCData.strData FROM tblMHCIntake INNER JOIN tblMHCIntakeDetail ON tblMHCIntake.lngIntakeId = tblMHCIntakeDetail.lngIntakeId INNER JOIN tblLUMHCData ON tblMHCIntakeDetail.lngDataId = tblLUMHCData.lngDataID RIGHT OUTER JOIN tblPatient ON tblMHCIntake.lngPatientId = tblPatient.lngPatientId WHERE (tblMHCIntake.dtmIntake > '1/1/2008')ORDER BY tblMHCIntake.dtmIntake DESC", Connection1)

        daSections.Fill(objDS, "dtSections")
        daContent.Fill(objDS, "dtContent")
        '    datype.Fill(objDS, "dtType")

        objDS.Relations.Add("SectionToContent", _
        objDS.Tables("dtSections").Columns("dtmIntake"), _
        objDS.Tables("dtContent").Columns("dtmIntake"))



        nodenew = New TreeNode
        nodenew.Text = "Create new Client Contact..."
        TreeView1.Nodes.Add(nodenew)
        For Each rowSupp In objDS.Tables("dtSections").Rows
         
            nodeSupp = New TreeNode
            nodeSupp.Text = rowSupp("dtmIntake")

            TreeView1.Nodes.Add(nodeSupp)
            For Each rowProd In rowSupp.GetChildRows("SectionToContent")
                nodeProd = New TreeNode
                nodeProd.Text = rowProd("intakedate") & " - " & rowProd("strStaff") & " - " & rowProd("name") & " - " & rowProd("dtmdob") & " - " & rowProd("strPatientid")
                'need to databind rowProd ("lngIntakeId")  
                nodeProd.Tag = rowProd("lngIntakeID")
                ' nodetype = New TreeNode
                '  nodetype.Text = rowProd("strdata")
                'need to databind rowProd ("lngIntakeId")  

                nodeSupp.Nodes.Add(nodeProd)
                '  nodeProd.Nodes.Add(nodetype)
            Next

        Next

Open in new window

running32Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
Try rephrasing the problem.
0
running32Author Commented:
Ok, I need to create a tree view.

Node  - Create new client contact
Node  - Intake date ( from sql query daSections)
child Node -   Information on Intake ( from sql query daContent)
     child Node  - Information on type of intake ( from sql query datype)

I can get it to work linking the dates and so when the tree opens there is client information under the intake date, what I need now is to add under the client information another child which has the type.  It needs to be linked to the client information not the date.

Does this make or sense?

0
CodeCruiserCommented:
No. Try adding some example with data.

>Node  - Create new client contact
You create a new client root node in code? All child nodes are populated from db right?

0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

running32Author Commented:

One of the roots is created by code the other (the date) is created by populating it from the db.
both chld notes are created by populating from db.
>  Create New Client
>  3/30/2010
    >   Jane Smith - 1/1/2010 -
         >  Intake      
> 3/29/2010
    >   John Smiht - 3/3/1198-
        >  Consult
    >  Test Person - 1/1/2000
        >   Intake
> 3/29/2010
    > Another Person 9/9/1999
         > Walk-in  
     

0
CodeCruiserCommented:
Ok. Now what node do you need to add? Another like this

> 3/29/2010
    > Another Person 9/9/1999
         > Walk-in

???
0
running32Author Commented:
I need to add the > Walk-in node.  I can't figure out the code to get it to display under the >Another Person 9/9/1999.

The > Walk-in node should be tied to datype.Fill(objDS, "dtType")

Thanks
0
CodeCruiserCommented:
You need to modify the loop which is populating the nodes to add subnodes.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
running32Author Commented:
go it, thanks

 For Each rowSupp In objDS.Tables("dtSections").Rows

            nodeSupp = New TreeNode
            nodeSupp.Text = rowSupp("dtmIntake")

            TreeView1.Nodes.Add(nodeSupp)
            For Each rowProd In rowSupp.GetChildRows("SectionToContent")
                nodeProd = New TreeNode
                nodeProd.Text = rowProd("intakedate") & " - " & rowProd("strStaff") & " - " & rowProd("name") & " - " & rowProd("dtmdob") & " - " & rowProd("strPatientid")
                nodeProd.Tag = rowProd("lngIntakeID")
                nodeSupp.Nodes.Add(nodeProd)
                For Each rowType In rowProd.GetChildRows("SectionToType")
                    nodetype = New TreeNode
                    nodetype.Text = rowType("strData")
                    nodeProd.Nodes.Add(nodetype)
                Next

            Next

        Next
0
CodeCruiserCommented:
Glad you got it working :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.