LINQ - Select Statement - The null value cannot be assigned to a member with type System.Int32 which
- by thiag0
I am trying to achieve the following...
_4S.NJB_Request request =
(from r in db.NJB_Requests
where r.RequestId == referenceId
select r).Take(1).SingleOrDefault();
Getting the following exception...
Message:
The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type.
StackTrace:
at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries)
at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
at System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
at DAL.SqlDataProvider.MarkNJBPCRequestAsComplete(Int32 referenceId, Int32 processState)
I have verified that 'referenceId' does have a value.
Anyone know why this would happen in a select statement?
Thanks!