hello, I need some some help regarding my project. I have a form with a combobox, and listbox. The combobox is populated with illnesses stored in the database. Now, when user select an illness in the combobox, the symptoms should be listed in the listbox. Here's how my table looks like:
f_id | illness | symptoms
1 | fever | dizziness
2 | fever | cold
3 | fever | hot temperature
4 | asthma | dizziness
5 | asthma | difficulty in breathing
6 | asthma | pale
so if user select fever from combobox, listbox will have dizziness, cold, hot temperature. I've already tried something but its not working:
Please help me correct the code. Thanks in advance.
f_id | illness | symptoms
1 | fever | dizziness
2 | fever | cold
3 | fever | hot temperature
4 | asthma | dizziness
5 | asthma | difficulty in breathing
6 | asthma | pale
so if user select fever from combobox, listbox will have dizziness, cold, hot temperature. I've already tried something but its not working:
Code:
Dim dtr As MySqlDataReader Dim cmd As New MySqlCommand With Me Call Connect() cmd.Connection = myConn cmd.CommandText = STRSQL STRSQL = "select sym from symptoms where ill = @rec" cmd.Parameters.AddWithValue("rec", cmbRecord.Text) dtr = cmd.ExecuteReader Dim symp As New List(Of String) While dtr.Read() symp.Add(dtr("symptoms")) End While lstSymp.DataSource = symp dtr = Nothing cmd = Nothing myConn.Close() Call Disconnect() End With
Comment