Treeview

Résolu
volcom20 Messages postés 15 Date d'inscription lundi 5 janvier 2009 Statut Membre Dernière intervention 6 janvier 2013 - 18 mai 2009 à 00:03
volcom20 Messages postés 15 Date d'inscription lundi 5 janvier 2009 Statut Membre Dernière intervention 6 janvier 2013 - 18 mai 2009 à 00:48
j'aimerais remplir mon treeview via un BD access mais je n'y arrive pas merci de votre aide

Private Sub RemplirTv()
tvproduits.Nodes.Clear()
con.Open()
con2.Open()
Dim com As New OleDbCommand("select * from T_produits", con)
Dim com2 As OleDbCommand

dr1 = com.ExecuteReader()

Dim node1, node2 As TreeNode

While dr1.Read()
node1 = New TreeNode(dr1("Pro_produit"))
node1.Tag = dr1("Pro_ID")
If (dr1("Pro_produit").ToString() = currentnode) Then
node1.Expand()
End If

com2 New OleDbCommand("SELECT T_categories.*, T_produits.*, T_manufacturiers.Man_ID, T_manufacturiers.Man_nom FROM T_manufacturiers INNER JOIN (T_categories INNER JOIN T_produits ON T_categories.Cat_ID T_produits.Pro_categorie) ON T_manufacturiers.Man_ID = T_produits.Pro_manufacturier", con2)

dr2 = com2.ExecuteReader()

Try
While dr2.Read()
Dim nom As String = dr2("T_manufacturiers.Man_nom").ToString()
node2 = New TreeNode(nom)
node2.Tag = dr2("T_manufacturiers.Man_ID")
node1.Nodes.Add(node2)
End While

dr2.Close()
tvproduits.Nodes.Add(node1)


Catch ex As Exception
MsgBox(ex.Message)
End Try

End While

dr1.Close()
con.Close()
con2.Close()

End Sub

1 réponse

volcom20 Messages postés 15 Date d'inscription lundi 5 janvier 2009 Statut Membre Dernière intervention 6 janvier 2013
18 mai 2009 à 00:48
Résolue
3
Rejoignez-nous