开发者

LINQ Group By problem

I am using VB.NET and DataSets; I have two tables and a relation. I'm querying the first table, but I can't use Group By on any field of the table. Here's the error I am seeing:

Definition of method 'G开发者_JAVA百科roupBy' is not accessible in this context

And my code is as follows:

Dim Groups = From n In dataSetTableAsEnumerable _
   Group By n.filedName  Into Group

Thanks for any assistance.


Imports System.Linq on the top of your vb code file.


You need to tell it which thing you're grouping, for example:

 Dim Groups = From n In dataSetTableAsEnumerable _
              Group n By n.filedName  Into Group _
              Select Group

In your case you need Group n By as opposed to just Group By.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜