I am trying to query a mysql database using the 'LIKE' keyword within my query based on what the user has input.
It works if I pass the string, however I am having trouble getting it to expand the parameter when combining it with the LIKE MySQL keyword.
As seen below parameters work in a simple SELECT without 'LIKE':
Expand|Select|Wrap|Line Numbers
- string sql2 = "SELECT * FROM vocab WHERE english LIKE '%" + english + "%'";
- string sql3 = "SELECT * FROM vocab WHERE english LIKE '%" + "@English" + "%'";
- string sql4 = "SELECT * FROM vocab WHERE english =@English";
The single quotes around the % symbols are probably the cause but I can't figure it out.
Could someone please tell me the correct syntax for the statement in sql3?