This is caused because of Where-Expression.
You should only use variables in there or call methods that can be translated to SQL.
First, save your Session value in a variable:
int userId= (int)Session["UserId"];
posts = db.Posts.Where(a => a.UserId == userId)
Then use userId in your Where-Expression.
Post your comments / questions
Recent Article
- How to Encode & Decode using Base64 in Python?
- Unspecified error-The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support.
- How to generate a Captcha verification code image with Python?
- How to show an image using path python PIL?
- How to remove Background from the images using Python?
- Python generate QR code image
- Insert excel file data into MySQL database in Python
- ImportError: Missing optional dependency 'xlrd' | How tot Convert xls to xlsx | Python
Related Article