Left outer join null using VB.NET and LINQ
Posted
by
jvcoach23
on Stack Overflow
See other posts from Stack Overflow
or by jvcoach23
Published on 2010-09-27T15:30:16Z
Indexed on
2014/08/25
10:20 UTC
Read the original article
Hit count: 282
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.
© Stack Overflow or respective owner