0
我正在研究'NorthWind'數據庫,我想將我的SQL代碼轉換爲LınQ。SQL查詢轉換爲LınQ
這裏我的代碼:
select s.CompanyName,o.OrderID, o.Freight
from Orders as o
join Shippers as s on o.ShipVia = s.ShipperID
我正在研究'NorthWind'數據庫,我想將我的SQL代碼轉換爲LınQ。SQL查詢轉換爲LınQ
這裏我的代碼:
select s.CompanyName,o.OrderID, o.Freight
from Orders as o
join Shippers as s on o.ShipVia = s.ShipperID
var query = from o in db.Orders
join s in db.Shippers on o.ShipVia equals s.ShipperID
select new {
o.OrderID,
o.Freight,
s.CompanyName
};
我建議你使用LINQ Pad學習LINQ和測試查詢。
ty兄弟代碼工作成功。 – 2013-02-27 11:54:26