我在.NET Framework4.0中,将imports System.Linq和System.Data.Linq放在顶部。我正在查询一个DataTable
类型的对象。另外,我还有System.Data.Linq、System.Xml.Linq和System.Data作为推荐人。
为什么我仍然可以使用Expression of type 'System.Data.DataTable' is not queryable. Make sure you are not missing an assembly reference and/or namespace import for the LINQ provider
我的LINQ查询:
dim count = (from row in changes select row.field(of String)("UnitID") distinct).count()
发布于 2015-03-17 19:01:18
试一试
dim count = (from row in changes.AsEnumerable() select row.field(of String)("UnitID") distinct).count()
MSDN - DataTableExtensions.AsEnumerable Method
Select方法适用于Enumerable或Queryable对象:
https://stackoverflow.com/questions/29107381
复制