I'm a bit confused here (undoubtedly due to being new to C# and entity framework but that's besides the point) I want to check for a situation where my query to the database returns no data and upon that happening set some values to variables on my page Below is the code I have up right now which is throwing an error telling me that I need to check for null on the very line where I am checking for null (if the UserName value is null the record was not returned as it is a required column). So what am I missing on how to go about checking for null return here?
using (CInTracDBEntities Context = new CInTracDBEntities())
{
var CInTracUsers = Context.CInTracUsers.Where(a => a.Login == HttpContext.Current.Request.LogonUserIdentity.Name).Select(x => new { x.Login, x.UserName, x.Status, x.StatusDate, x.ReviewDate }).FirstOrDefault();
if (CInTracUsers.UserName == null)
Thanks, Ken....