MilkBottle
MilkBottle

Reputation: 4332

Can mix up parameter query in SQL statement in SQLite

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

Answers (1)

CL.
CL.

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

Related Questions