Cannot overlay an object of type "System.Double" on type "System.Nullable`1 [System.Single]"
Why am I getting the above error in this LINQ query - and how can I solve it?
System.Nullable<float> totalFreight =
(from cust in db.Customers
join ord in db.Orders on cust.ordID equals ord.OrdID
select ord.Freight).Sum();
Note : the Freight
attribute / column in the entity / table Orders is of type float?
. I am using EF Core 1.1
with VS2015
.
UPDATE . I am trying to follow this and this MSDN Examples.
UPDATE 2 . I have highlighted the problem as follows. Moreover, I checked by hovering over ord.Freight
that Freight is indeed a float:
var totalFreight =
from cust in db.Customers
join ord in db.Orders on cust.ordID equals ord.OrdID
select ord.Freight
var testSum = totalFreight.Sum();
But you still get the same error, this time on the line: var testSum = totalFreight.Sum();
source to share
No one has answered this question yet
See similar questions:
or similar: