views:

68

answers:

1
Dim Cozinhas as string = "1, 2, 3"
Dim FiltroCozinha() As String = Cozinhas.Split(",")

Dim Empresas = (From E In lstEmpresas _
                Group Join CE In lstCozinhasEmpresas On CE.EmpresaID Equals E.EmpresaID Into CEJ = Group From CE In CEJ.DefaultIfEmpty() _
                Group Join FC In lstFiltroCozinha On FC Equals CE.CozinhaID Into FCJ = Group From FC In FCJ.DefaultIfEmpty() _
                Select New With {E.Nome} _
               ).Distinct.ToList

Throws exception "Object reference not set to an instance of an object."... but if I remove

                Group Join FC In lstFiltroCozinha On FC Equals CE.CozinhaID Into FCJ = Group From FC In FCJ.DefaultIfEmpty() _

It works. How do I do left join with the array "FiltroCozinha"?

+1  A: 

I think you are declaring and utilizing the same variable in the same line

Dim Empresas = (From E In Empresas _

Daniel A. White
Sorry, I simplified the code... consider other name to the object....Dim Empresas = (From E In New BO.Empresa().Select() _...The problem continues!
Fernando
So are you sure that `lstEmpresas` is not `Nothing`?
Pavel Minaev