Hello guys,
I am trying to dynamically update a combobox using mysql database, however I get the Error Catch Message.
Any help would appriciated.
Private Sub cmbName_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbName.DropDown
Try
dbCon = New MySqlConnection("SERVER=localhost;DATABASE=test;")
strQuery = "Select name from customer_details"
cmbName.Items.Clear()
If DR.HasRows = 0 Then
Else
cmbName.Items.Add(DR(0).ToString)
End If
SQLCmd = New MySqlCommand(strQuery, dbCon)
DR = SQLCmd.ExecuteReader
dbCon.Open()
DR.Close()
dbCon.Close()
Catch ex As Exception
MsgBox("Failure to communicate!" & vbCrLf & vbCrLf & ex.Message)
End Try
End Sub