So I was trying to convert a SQL into LINQ query
the logic is:
JOIN SalesPeriod SP1
ON
SP1.SalesPeriodId = SE1.SalesPeriodId AND SP1.SalePeriodId = .....(XML stuff)
but it keeps complaining the types on both sides of equals statement don’t match
Any ideas?
Note: I declared b and d because it doesn’t accept anonymous type members
and I tested two equal conditions separately and they both work
thanks
join SP1 in fentities.SalesPeriods
on new { SE1.SalesPeriodId, b = XDocument.Load(MI.Body).Element("ns:Transfer").Element("ns:ReceivedBy").Element("ns:Id").FirstNode.ToString() }
equals new { SP1.SalesPeriodId, d = SP1.SalesPeriodId.ToString() }
Simple, they’re not the same (compatible) types. The first key has a
SalesPeriodIdof type whatever, andbof type string. The second key has aSalesPeriodIdof type whatever (probably the same as the first’s), anddof type string. You can’t compare these to eachother. It must have the same properties of the same types declared in the same order. Just pick one of the namesbordand use that name.