How do we use a LIKE with wildcards in a custom sql with servicestack ORMLite?
Following code does not seem to work:
var sql="SELECT TOP 10 Id,Value FROM SomeTable WHERE Value Like '%@term%'"
var results = Db.Select<CustomDTO>(sql, new {term = "stringToSearch"})
You need to add the wildcard to the param value, e.g:
var sql = "SELECT Id,Value FROM SomeTable WHERE Value Like @term";
var results = db.Select<SomeTable>(sql, new { term = "%foo%" });