The Linq query is ultimately transformed into an SQL query and LINQ doesn't know what to do with Session["UserName"] (that gets the "UserName" item).
A common way to workaround this is just to use a local variable to which you'll assign Session["UserName"] and that you'll use in your Linq query...
like
string loggedUserName = Session["LogedUsername"].ToString();
var userdetail =
dc.faculties.Where(a => a.F_UserName.Equals(loggedUserName)).FirstOrDefault();
A common way to workaround this is just to use a local variable to which you'll assign Session["UserName"] and that you'll use in your Linq query...
like
string loggedUserName = Session["LogedUsername"].ToString();
var userdetail =
dc.faculties.Where(a => a.F_UserName.Equals(loggedUserName)).FirstOrDefault();
No comments:
Post a Comment