I have a complex LINQ to SQL to query, which joins onto two tables - one is rather simple and works fine, but one is fairly complex and I'm getting The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'GroupJoin
It's a rather long query, and I do development on a work with Internet access so I thought I'd see if the line that seems to be the issue is enough:
join consignments in dc.Consignments
.FirstOrDefault(x => x.TripDate > dateFrom
&& x.TripDate < dateTo
&& x.DeliveryDepot == depot.Letter
&& (x.DeliveryStatus == 2 || x.DeliveryStatus == 3))
on new { Reg = s.VehicleReg, Depot = s.VehicleDepot }
equals new { Reg = consignments.VehicleReg, Depot = consignments.DeliveryDepot }
into con
I've ensured that the data types are the same, but it still doesn't work. Any ideas?
Are you sure that s.VehiculeDepot is the same type as consignments.DeliveryDepot ?
on new { Reg = s.VehicleReg, Depot = s.VehicleDepot }
equals new { Reg = consignments.VehicleReg, Depot = consignments.DeliveryDepot }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With