日期:2014-05-20 浏览次数:20713 次
Dim total = From R In DtSet.Table("Sale_d").AsEnumerable() _ Group R By R..Field(Of Integer)("Customer_Id") Into G _ Select New With _ { key=G.Key, _ .A =(From x In G Select x.Qty_Sale).Sum(), _ .B = (From x In G Select x.Amt_Sale).Sum() }
------解决方案--------------------
Dim total = (From R In DtSet.Table("Sale_d").AsEnumerable() _ Group R By R..Field(Of Integer)("Customer_Id") Into G). Select(Function(x) Dim a = (From x In G Select x.Qty_Sale).Sum() Dim b = (From x In G Select x.Amt_Sale).Sum() Return New With _ { .key = G.Key, _ .A = a, _ .B = b }
------解决方案--------------------
http://msdn.microsoft.com/en-us/vbasic/bb737908
看看这个 也许能帮到你
------解决方案--------------------
Public Sub Linq41() Dim words = New String() {"blueberry", "chimpanzee", "abacus", "banana", "apple", "cheese"} Dim wordGroups = From w In words _ Group w By Key = w(0) Into Group _ Select FirstLetter = Key, WordGroup = Group For Each g In wordGroups Console.WriteLine("Words that start with the letter '{0}':", g.FirstLetter) For Each w In g.WordGroup Console.WriteLine(w) Next Next End Sub