Reputation: 4332
Not sure If I can use this ?-operator in a Mix Up SQL statement for parameter Query. Is there any rule on this? Or I must use ? operator all the way.
Thank
Example: var allUsers = await db.QueryAsync("Select * From Customer Where CompanyName =?" + " AND Name like '" + txtBxName.Text + "%'", Company);
Upvotes: 0
Views: 269
Reputation: 180060
It is possible to use parameters only for some strings, but that would be silly.
Appending %
to a string can be done either in C#:
db.QueryAsync("SELECT ... ? ... Name LIKE ?", Company, txtBxName.Text + "%");
or in SQL:
db.QueryAsync("SELECT ... ? ... Name LIKE ? || '%'", Company, txtBxName.Text);
Upvotes: 1