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
and this is my RawMaterial table
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);
精彩评论