i have a Problem with UNION for LINQ to SQL
I have my LINQ query
Dim dc As New ContainerDB.DataClassesDataContext()
Dim test = (From container In dc.GetTable(Of tbl_container)() Where container.pkContainerID = iPkContainerID).Union( _
From containerHist In dc.GetTable(Of tbl_containerHIST)() Where containerHist.pkContainerID = iPkContainerID)
I always get implicit conversion error
System.Linq.IQueryable(Of
ContainerDB.tbl_containerHIST) in
System.Collections.Generic.IEnumerable(Of
ContainerDB.tbl_container).
Whats wrong on that query?
What am i missing?
Thanks in advance
Try to put
Option Infer On. This will enable the use of type inference, which you seem to be doing here:EDIT
Also, you need to use anonymous types:, so tbl_container and tbl_containerHIST can be compared: