Left outer join in LINQ is showing exception

Posted by stackuser3 on Stack Overflow See other posts from Stack Overflow or by stackuser3
Published on 2010-04-27T06:01:04Z Indexed on 2010/04/27 6:03 UTC
Read the original article Hit count: 200

Filed under:
|

The folloqing is the excpetion I am getting The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type. below is my LINQ Statement where QuestionId is the primary key in my table var questionViewsData = from questionViews in objDc.SC_QuestionsViews join questions in objDc.SC_Questions on questionViews.QuestionId equals questions.QuestionId into qs from questions in qs.DefaultIfEmpty() where questionViews.CreatedDate.Date == new DateTime(2010, 4,27) select new { Selected =(questions == null ?-1:questions.QuestionId), QuestioinTitle = questions.Title, VotesCount = questions.VotesCount };

Let me know how to resolve this

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ