Reputation: 1909
I'm in .NET Framework 4.0, have imports System.Linq and System.Data.Linq at the top. I'm querying an object of type DataTable
. Plus I have System.Data.Linq, System.Xml.Linq, and System.Data as references.
Why am I still getting
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
?
My LINQ query:
dim count = (from row in changes select row.field(of String)("UnitID") distinct).count()
Upvotes: 1
Views: 4568
Reputation: 764
Try
dim count = (from row in changes.AsEnumerable() select row.field(of String)("UnitID") distinct).count()
MSDN - DataTableExtensions.AsEnumerable Method
The Select Method works for Enumerable or Queryable objects:
Upvotes: 1