The scenario is, I have simple Post table with just title & story. after posting a new post I want to show the post using my view page.I have write the method to display the post as follows:
\\Post is the class name & item is the obj to bind it from the view form.
public List<Post> ViewPost(Post item)
{
using(var context=new TourBlogEntities1())
{
var post= from s in context.Posts
where s.PostID=item.PostID //showing error here.
select s;
return post.ToList<Post>();
}
}
I’m getting an error saying ‘can’t convert the lambada expression to type string because its not a delegate type’.
Whats need to be done? some more information would also be helpfull, like I have a field name userid in post table, which I want to fill automatically by using the logging info. How can I do that? Thanks.
In your LINQ query replace:
with:
The
whereLINQ operator expects a boolean condition and not an assignment.