Left outer join null using VB.NET and LINQ
- by jvcoach23
I've got what I think is a working left outer join LINQ query, but I'm having problems with the select because of null values in the right hand side of the join. Here is what I have so far
Dim Os = From e In oExcel
Group Join c In oClassIndexS On c.tClassCode Equals Mid(e.ClassCode, 1, 4)
Into right1 = Group _
From c In right1.DefaultIfEmpty
I want to return all of e and one column from c called tClassCode. I was wondering what the syntax would be. As you can see, I'm using VB.NET.
Update...
Here is the query doing join where I get the error:
_message = "Object reference not set to an instance of an object."
Dim Os = From e In oExcel
Group Join c In oClassIndexS On c.tClassCode Equals Mid(e.ClassCode, 1, 4)
Into right1 = Group _
From c In right1.DefaultIfEmpty
Select e, c.tClassCode
If I remove the c.tClassCode from the select, the query runs without error. So I thought perhaps I needed to do a select new, but I don't think I was doing that correctly either.