开发者

How can write query to select all information where RawMaterialID=1

i am designing a project in asp.net mvc3. this is my table

How can write query to select all information where RawMaterialID=1

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜