开发者

how to write combined query to access data in asp.net mvc3

i am designing a project in asp.net mvc3, i have designed database in sql server, and i added this in App_Data using ADO.net connection.

this is my ProductFormulation Tabl开发者_高级运维e

how to write combined query to access data in asp.net mvc3

and this is my RawMaterial table

how to write combined query to access data in asp.net mvc3

now i want to get Code from RawMaterial table where ProductID=1 in ProductFormulation. please tell me what query should i write. I am using Razor view engine.


select rm.Code 
from RawMaterial rm 
    inner join ProductFormulation pf 
        on pf.RawMaterialId = rm.id 
where pf.productid = 1

should get you where you need to go


Write in ur controller ->any function

var res = (from x in RawMaterial 
join y in ProductFormulation on x.ID equals y.ID where y.productID = 1 select y.Code)
return View(res);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜