This has confused me, I have the title error on the join in the following LINQ:
var r = (from k in location.tblKeyAccountInfoes
join l in location.tblLocations
on new { k.MemberID, k.LocationID } equals
new {l.MemberId, l.LocationId }
where k.MemberID == memberid && k.UserName == username
select l.LocationName);
return r.ToString();
However, the type for MemberId and LocationId is the same so I'm not sure what I have done wrong.
Any pointers gratefully received.
The types of MemberID and LocationID may be the same, but they have to have the same name as well.
In your example, one of them has ID (capital D) and the other has Id (lower-case d). That is enough to make the anonymous types separate types.
You can fix this by specifying names explicitly, for example:
join l in location.tblLocations
on new { k.MemberID, k.LocationID } equals
new { MemberID = l.MemberId, LocationID = l.LocationId }
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