开发者

Could not format node 'Link' for execution as SQL

开发者 https://www.devze.com 2023-02-06 05:05 出处:网络
Table1 with Name, Address CityID(foreign key from Table2) and Table2 with CityID, CityName. I am using LINQ to SQL to retrieve data. When I try to oderby CityName I get the following error: base
Table1 with
Name, 
Address
CityID(foreign key from Table2) 

and Table2 with

CityID,
CityName.

I am using LINQ to SQL to retrieve data. When I try to oderby CityName I get the following error: base {System.SystemException} = {"Could not format node 'Link' for execution as SQL."}

Here's my LINQ code to retrieve data :

var Person = from person in db.Ta开发者_JS百科ble1 
                orderby person.Table2.CityName
                select person;

Can someone point me why its causing the above mentioned error.

Thanks!


Based on this bug report and my own testing (I was able to reproduce this), it looks like your Table2.CityName property may have Delay Loaded = True in the dbml designer.

Apparently you can't order by a delay-loaded property, so changing Delay Loaded to False on your Table2.CityName property in the DBML designer should take care of it.

0

精彩评论

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