Could not format node 'Link' for execution as SQL
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.
精彩评论