I currently nearly finished a simple application, but my query doesnt work. I have a combobox and a textbox. By selecting a column name from the combobox, I want to be able to search in the textbox within that column. Anyone that can fix this query? I've been trying alot but havent had any succes yet.
SqlCommand command = new SqlCommand("SELECT * FROM dbo.Kwartaal " +
"WHERE '" + searchField + "' LIKE '% " + txtSearch.Text + "%' ", con);
Edit: searchField is my string that gets filled by selecting the column. txtSearch is the textbox obviously.
Amit GuptaPosted Jul 14, 2017, 8:10 AM
Baka MuskyPosted Jul 14, 2017, 9:03 AM
Baka MuskyPosted Jul 14, 2017, 8:03 AM
It works now, but only with columns that has letters in it, if there are numbers and I search for an ID it doesnt work. Any fix on that?
Amit GuptaPosted Jul 14, 2017, 7:45 AM
Baka MuskyPosted Jul 14, 2017, 7:38 AM
Amit GuptaPosted Jul 14, 2017, 7:29 AM