views:

44

answers:

2

I write this piece of code with C# using ADO.NET Entity Framework.

I found error in here

var departmentQuery = from d in schoolContext.Departments.Include("courses")
                              orderby d.Name // here
                              select d;

Error message is like the following:

Cannot convert lambda expression to type 'string' because it is not a delegate type 

I am doing according this articles

http://msdn.microsoft.com/en-us/library/bb386884.aspx

please point out what do i need to modify?

Thanks in advance!

Best regards, RedsDevils

+2  A: 

Make sure you have the using System.Linq in the code. Add a reference for this in project if you are unable to find it in your intellicence.

Bhaskar
yea it works. Thanks alot! You save my time! :)
RedsDevils
+1  A: 

The only difference I can see between your code and the example is that you have a small "c" in "courses".

Lunivore
Yea thanks that's too! but it's solved by referencing System.Linq Like Bhaskar says. Thanks anyway.
RedsDevils