Reputation: 1309
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.Table1
orderby person.Table2.CityName
select person;
Can someone point me why its causing the above mentioned error.
Thanks!
Upvotes: 1
Views: 1137
Reputation: 3919
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.
Upvotes: 3