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
- ModuleNotFounEerror:No module named celery in Django Project
- How to get domain name information from a Domain using Python
- ModulenotFoundError: no module named 'debug_toolbar' -SOLUTION
- How to create superuser in django project hosted in cPanel without terminal
- CSS & images not loading in django admin | cpanel without terminal
- Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects
- How to sell domain name on Godaddy (2023)
- TemplateSyntaxError at / Could not parse the remainder: ' + 1' from 'forloop.counter0 + 1'
Related Article