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)

The correct sql statement would be:

("SELECT * FROM daftarpelajar WHERE '" & cbChoice.Text & "' Like '%" & txtSearch.Text & "%' ORDER by id_pelajar ", conn)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.