Sk Asraf Sk Asraf - 5 months ago 15
SQL Question

how to write entity framework query as like **like 'lap%'**

I can't understand how can I write query like

select * from product where name like 'Lap%'


in Entity Framework

my dbcontext is

dbFoodZoonEntities1 db = new dbFoodZoonEntities1();

Answer

Try this

dbFoodZoonEntities1 db = new dbFoodZoonEntities1();
var result = db.product.Where(x=>x.name.StartsWith("Lap")).ToList();
Comments