This is a relatively ambiguous error that seems to pop up frequently when first learning LINQ. It took a lot of hunting around on the web to finally come up with an appropriate response to what the issue is. Here’s a link to the article that I found most useful.
Basically, in LINQ, you need to use an anonymous type in order to JOIN b ased on two (or more) columns. Additionally, and where my confusion was, was that you need to “ALIAS” your columns if they are not named the same thing in your two tables (objects).
example LINQ JOIN clause :
…. on new { p.FirstName, p.LastName } equals new { FirstName = q.FName, LastName = q.LName } ….
Note the “=” sign in the above C# example, it is not an “==”. The “=” sign is aliasing the column name!
I hope this helps!
Comments on this entry are closed.