Go to Comments





Using sql like operator in dapper orm


Created: 22/06/2016 08:35:06 p.m.





Using sql like operator in dapper orm


Example:
(This is just an option you can use it or find another way)

conn.Open();
clientes = conn.Query<Cliente>("SELECT * FROM tbl_clients WHERE name like @filter and state = 1",
new
{
      filter = "%" + filter + "%"
}).ToList();


So basically you have to include percent sign directly in your parameter value.

filter = "apple" => "%" + "apple" + "%" => "%apple%"




Comments: