I am getting the following exception:
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
};