I have a LINQ statement which is working great... its part of select here it is
select new
{
Net = (System.Double?)
((from m0 in MOVTOS
where m0.DocumentType == "NET" && m0.ClientCode == c.ClientCode
group m0 by new { 0.ClientCode } into g
select new
{
Expr1 = (System.Double)g.Sum(p => p.Amount)
}).First().Expr1)
};
Now if you notice i am using System.Double?
(nullable double) as a cast at the begging due to the fact that some values are returned as NULL on the SUM.
If i change it to System.Double it fails with error
The null value cannot be assigned to a member with type System.Double which is a non-nullable value type
So what i would like to do is return the value of the SUM but if it is NULL then enter a 0 in there.
Any help really appreciated