Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi!
After I created Data Access Layer in my project ,I created new method in my controller and also a new view....now I just want to push all my data from the model to my new view and i wrote this line in the view : @model otto.Models.Supply;
the error that I got is : only assignment,call,increment,decrement,await,new object expression can be used as a statement

what I should do?

thanks in advance
Posted
Comments
Krunal Rohit 12-Nov-15 10:37am    
Can you share your controller and view code ?

-KR

Remove the semi-colon from the @model directive in your view:
Razor
@model otto.Models.Supply
 
Share this answer
 
What to do? Apparently, use assignment, call, increment, decrement, await or new as a statement. :-)

Please, what's the use of telling us an error message without showing some code causing this message? But, more importantly, why creating things like "Data Access Layer" without knowing the basics of language and having most basic skills? Fundamental things are best learned on the simplest samples, not on real projects.

Where we face such exceptions. Well, "reverse-engineering" your error message into your error would be quite pointless, but, in this case, pretty funny. How can we even managed to write a non-statement and cause this error? Apparently, where a statement is expected. Let's see:
C#
static void Foo() {
    Foo; // in this line, not a statement
}

or, say,
C#
static class MyClass { }
static void Foo() {
    MyClass; // this this line;
    // however, in this case,
    // there will be two error messages
}
Something like that. (The word "static" is added only to extend the number of possible contexts where exactly these error messages should be expected.)

But if I also had to explain what's wrong in these pieces of "code", I would be talking to a wrong listener. Indeed, when one face such mistakes? When one simply enters code fast and nearly accidentally clicks "Build" before a line if complete, otherwise this is the person having no clue what she/he is doing; only then such questions may be posed.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900