Hi all! I’m trying to make this query work, but it seems that it can’t replace @word with “chem”; if I write it in plain-text in the query everything works…
var anagrafiche = Db.Select<AN01_ANAGGEN>(
@"SELECT AN01_IDANAGGEN, AN01_RAGSOCANAG
FROM AN01_ANAGGEN
WHERE (AN01_IDANAGGEN LIKE '%@word%')
OR (AN01_RAGSOCANAG LIKE '%@word%')
OR (AN01_ALIAS LIKE '%@word%')", new { word = "chem" });
Please always provide the StackTrace if you’re reporting an error (and as much info about the error as you can), makes it very hard at identifying issues otherwise.
Thanks mythz and I apologize for any inaccuracies in error reporting.
I let here the solution:
var anagrafiche = Db.Select<AN01_ANAGGEN>(
@"SELECT AN01_IDANAGGEN, AN01_RAGSOCANAG
FROM AN01_ANAGGEN
WHERE (AN01_IDANAGGEN LIKE @word)
OR (AN01_RAGSOCANAG LIKE @word)
OR (AN01_ALIAS LIKE @word)", new { word = "%" + request.Word + "%" });