我在.NET Framework 4.0中,在顶部导入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()
答案 0 :(得分:0)
尝试
dim count = (from row in changes.AsEnumerable() select row.field(of String)("UnitID") distinct).count()
MSDN - DataTableExtensions.AsEnumerable Method
Select方法适用于Enumerable或Queryable对象: