0

I have a problem to make a selection by using combo box(cbChoice). if I have 2 item [name], [age], [id_number]. After click SEARCH button, the data from database will display to textbox. this my code but its not work

myCommand = New MySqlCommand("SELECT * FROM daftarpelajar WHERE " & cbChoice.Text & " Like '%" & txtSearch.Text & "%' ORDER by id_pelajar ", conn)

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Begginnerdev
1

The correct sql statement would be:

("SELECT * FROM daftarpelajar WHERE '" & cbChoice.Text & "' Like '%" & txtSearch.Text & "%' ORDER by id_pelajar ", conn)
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.