[vb.net] probleme avec mon combobox
voila j récupéré la liste de mes référence depuis ma base de données mais le problème c'est que j'arrive pas a sélectionné aucune valeur ?????
voici le code que j effectué :
Code:
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 29 30
|
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged, ComboBox1.Click
Dim conn As MySqlConnection
Dim dr As MySqlDataReader
Dim MyAdapt As New MySqlDataAdapter
conn = New MySqlConnection()
conn.ConnectionString = "Data Source= localhost;user id= utilisateur ;password=1234;database=dolibarr"
Try
conn.Open()
Dim myCommand As New MySqlCommand
Dim strQuery As String
strQuery = "SELECT " & _
"llx_product.ref " & _
"FROM " & _
"llx_product"
myCommand.Connection = conn
myCommand.CommandText = strQuery
dr = myCommand.ExecuteReader()
ComboBox1.Items.Clear()
If dr.HasRows Then
Do While dr.Read()
ComboBox1.Items.Add(dr.GetString(0))
Loop |