I have a query, may be poorly written since I'm not sure about this at all, that tries to join (3) tables over (2) contexts, since we have split the database into different logical areas. I get the following error message "The query contains references to items defined on a different data context."
Dim _db As DBML.XDataContext
_db = New DBML.XDataContext(ConfigurationManager.ConnectionStrings("TempConnectionString").ToString)
Dim _db1 As DBML.YDataContext
_db1 = New DBML.YDataContext(ConfigurationManager.ConnectionStrings("TempConnectionString").ToString)
Dim FAL = (From r In _db.SendingD _
Join e In _db1.Entity On r.USR_FA Equals e.FANo _
And r.USR_HomeD Equals e.OANo _
Join b In _db1.Buildings On e.OBNo Equals b.BuildNo
Where r.USR_FA = FA _
Select b.BuildNo, b.BuildName).ToList()
For Each ab In FAL
list.Add(New ListItem(ab.BuildNo & "-" & ab.BuildName, ab.BuildNo))
Next
Return list
What would I need to do to join the tables to get the results. SendingD is related to Entity on USR_FA = FAno
and USR_HomeD = OANo
and then Entity is related to Buildings on OBNo = BuildNo