Salut....
voila j'ai un combobox avec 3 valeurs :
Comment je fais pour faire un select mysql pour retrouver la valeur du combobox ? J'ai essayer ceci mais sans succes.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 Try MysqlConn.Close() MysqlConn.Open() Dim Query As String Query = "select id, name,id_maker, id_types from product ORDER BY name ASC" COMMAND = New MySqlCommand(Query, MysqlConn) READER = COMMAND.ExecuteReader While READER.Read Dim sName = READER.GetString("name") Dim sMaker = READER.GetString("id_maker") Dim sTypes = READER.GetString("id_types") Dim sId = READER.GetString("id") ' 'ComboBox1.Items.Add(sName) ComboBox1.Items.Add(String.Format("{0} | {1} | {2}", sName, sMaker, sTypes)) End While Catch ex As Exception MessageBox.Show(ex.Message) Finally MysqlConn.Dispose() End Try
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Dim Str() As String = ComboBox1.Text.Split(" | ") COMMAND.CommandText = "select id,name, foto,id_maker,id_types from product where name = '" & Str(0) & "' AND id_maker = '" & Str(1) & "' AND id_types = '" & Str(2) & "'"
Partager