C# SQLite Parameterized Select Using LIKE
You can't do that. The parameters must be complete values - it's not just a string substitution into the SQL. You could do this instead:
string sel = "SELECT * FROM [TABLE] WHERE hostname LIKE @host";...command.Parameters.AddWithValue("@host", "%myhostname%");
Easiest way to do this is to use '||'
Use :
const string qry = "SELECT SiteNum FROM WorkTable WHERE WTName LIKE @wtName || '%' ";
Instead Of:
const string qry = "SELECT SiteNum FROM WorkTable WHERE WTName LIKE @wtName%";
I have already answered here