link
http://msdn.microsoft.com/en-us/library/ee796239%28v=vs.91%29.aspx#Y3078
the code
return this.ObjectContext.SalesOrderHeaders.OrderBy(e=>e.SalesOrderID);
note
- have done and checked everything done till now is according to the tutorial
- my table is named SERVER,
so something like, the following should work,
return this.ObjectContext.SERVERs.OrderBy(e=>e.username);
prob
Visual Studio 2010 says that there is no "e".
EDIT THE ERRORS-
Error 13 Cannot convert lambda expression to type 'string' because it is not a delegate type D:\DOCUMENTSS\Visual Studio 2010\Projects\ExampleBusinessApplication\ExampleBusinessApplication.Web\DomainService1.cs 35 55 ExampleBusinessApplication.Web
Error 14 A local variable 开发者_如何学Gonamed 'e' cannot be declared in this scope because it would give a different meaning to 'e', which is already used in a 'parent or current' scope to denote something else D:\DOCUMENTSS\Visual Studio 2010\Projects\ExampleBusinessApplication\ExampleBusinessApplication.Web\DomainService1.cs 35 55 ExampleBusinessApplication.Web
The error message appears to be telling you that e
is already defined as something (presumably a string) elsewhere in the scope that contains your return
statement. Without seeing your code, I can only conjecture that you have something like this:
method()
{
string e = "abcd";
return this.ObjectContext.SERVERs.OrderBy(e=>e.username);
}
That isn't going to work, because the symbol you're trying to use as an argument to a lambda expression is already declared.
If you don't understand the use of =>
syntax for declaring delegates, you owe it to yourself to figure that out. :) Here's a tutorial, for example.
精彩评论