I have the following query:
int? Giver = Convert.ToInt32(db.vwAssignments.Sum(a => a.Amount));
but if there is no records that matches the search criteria then the following error will be raised
The cast to value type 'Int32' failed because the materialized value is null. Either the result type's generic parameter or the query must use a nullable type.
pls help