How do i use the ComboBox.Text as the Column in the WHERE statement of the query?
Here's my code.
If cboShowOnly.Text = "Province" Then
valCbo = "Prov_Name"
ElseIf cboShowOnly.Text = "Municipality" Then
valCbo = "Mun_Name"
ElseIf cboShowOnly.Text = "Bank" Then
valCbo = "BANK_ACCNT"
ElseIf cboShowOnly.Text = "Branch" Then
valCbo = "Branch_Name"
ElseIf cboShowOnly.Text = "Assigned Account" Then
valCbo = "Assigned_Account"
End If
Select * from view_remit WHERE '" & valCbo & "' = '" & txtGroupBy.Text & "'"
the Items
listed in the cboShowOnly.text
are the column
names of the view_remit
here's the Image of my code
here's what i want to happen > Image of working mysql statement
am i doing it wrong? is there any other way?
Try this one:
Dim da as As New MySqlDataAdapter("Select * FROM view_remit WHERE '" + volCbo + "' = '" & txtGroupBy.Text & "'",conn)