petapoco

PetaPoco: How to use the SQL Like keyword ( WHERE Name LIKE '%@0%')


What is the correct syntax for this query?

var l=db.Fetch<article>("SELECT * FROM articles WHERE title LIKE '%@0%'", 'something');

Or should I use CHARINDEX?


Solution

  • May be

    var l=db.Fetch<article>("SELECT * FROM articles WHERE title LIKE @0", "%something%");