1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
Dim cmd As New SqlCommand("SELECT distinct Tag.NomTag,Tag_ParentTag.RefParentTag FROM Tag_ParentTag, Tag WHERE Tag_ParentTag.RefParentTag NOT IN (SELECT RefTag FROM Tag_ParentTag)and Tag_ParentTag.RefParentTag=Tag.IdTag ", con)
con.Open()
Dim Mycommand As SqlCommand = con.CreateCommand()
Dim rRoot As SqlDataReader = cmd.ExecuteReader()
Do While rRoot.Read()
Me.TreeView1.Nodes.Add(rRoot.Item(0))
Loop
rRoot.Close()
con.Close()
For j = 0 To GetData(cmd).Rows.Count - 1
Dim cmde1 As New SqlCommand("SELECT RefTag FROM Tag_ParentTag WHERE RefParentTag='" & GetData(cmd).Rows(j).Item(1) & "'", con)
For k = 0 To GetData(cmde1).Rows.Count - 1
Dim rqSql_Nod1 As String = "select NomTag from Tag where IdTag=any (select RefTag from Tag_ParentTag where RefTag='" & GetData(cmde1).Rows(k).Item(0) & "')"
Dim NewCmd As New SqlCommand(rqSql_Nod1, con)
Mycommand.CommandText = rqSql_Nod1
For i As Integer = 0 To GetData(NewCmd).Rows.Count - 1
Me.TreeView1.Nodes.Item(j).Nodes.Add(GetData(NewCmd).Rows(i).Item(0))
Next
Next
Next |
Partager