Linq to sql - left outer Join

时间:2010-09-02 09:52:04

标签: linq-to-sql

HI ..!

Dim query = From c In cntxtNorthWind.Customers _
Join x In cntxtNorthWind.Orders On c.CustomerID Equals x.CustomerID into sr _
from b in sr.DefaultifEmpty() _
Select c.CustomerID, x.OrderID, x.ShipAddress

以上左外连接无法执行它的 “预期的结束”

1 个答案:

答案 0 :(得分:0)

您需要选择一个对象。返回匿名对象的最简单方法。 (不知道如何键入VB.net,但我知道它是这样的):

...
select new { c.CustomerID, x.OrderID, x.ShipAddress };

相信它就像我的VB.net:

...
select New With { c.CustomerID, x.OrderID, x.ShipAddress }