ServerError in '/' Application.
LINQ to Entities doesnot recognize the method 'System.Object get_Item(System.String)'
method, andthis method cannot be translated into a store expression.
A Linq query is translated to SQL to be performed against the database. Make sure you need to assign session or form request to a variable first because that has no access to it, and use this variable in the query.
int userId = (int)Session["UserId"];
var hasrecord = db.Submits
.Where(m =>m.Published == false && m.CreatedUserId ==userId)
.OrderByDescending(m => m.SubmitId);
Post your comments / questions
Recent Article
- How to Enable Virtualization in BIOS Security Settings in Intel Processors For Android Studio?
- Dependency 'androidx.activity:activity:1.8.0' requires libraries and applications that depend on it.
- AttributeError: 'NoneType' object has no attribute 'get_text' - Python
- ModuleNotFoundError: No module named 'openpyxl' - Python
- How to get thumbnail from vimeo video URL in Python?
- Remove all special characters, punctuation except spaces from string - Python
- OSError: cannot write mode RGBA as JPEG- Python
- expected str, bytes or os.PathLike object, not JpegImageFile - Python
Related Article