开发者

Error with LINQ to typed dataset. "Could not find an implementation of the query pattern for source type.."

Using VS2008 & .NET 3.5. I am getting an error message "Could not find an implementation of the query pattern for source type 'xxx.BuildingsDataTable'. 'Where' not found. Consider explicitly specifying the type of the range variable 'building''. (xxx is a namespace)

my linq query:

var query = from building in buildingDS.Buildings
                            where building.BuildingID == 1
                            select new { building.Name };

buildingDS is a typed dataset. VS can intellisense buildingDS but it can't intellisense building (buildingID & Name are in red). I have references to System.Data.Linq, System.Data.DataSetExtensions & System.Core. Enf开发者_C百科orceConstraints for the dataset = true. I tried casting building to the dataRow type but it didn't work. Not sure what it wants me to do with 'building'.

How do I get the query to compile?


Make sure that your typed dataset has been processed by the new .Net 3.5 generator.
Each table class should inherit TypedTableBase<TRow>.

If your table class inherits DataTable directly, regenerate the typed dataset.

Also, make sure that your code file contains using System.Data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜