How can write query to select all information where RawMaterialID=1
i am designing a project in asp.net mvc3. this is my table
i want to print all info开发者_如何学Gormation where RawMaterialID=1
please suggest me how should i write query to do this. I am using Entity Framework to access database.
You can use Lambda expression or can use sql syntax.
var results = (from x in dbContext.MaterialTable
where x.RawMaterialID == 1
select x);
Or
var results = dbContext.MaterialTable.Where(r => r.RawMaterialID == 1);
It would be something like
var results = dbContext.MyTable.Where(r => r.RawMaterialID == 1);
精彩评论