LINQ - Multiple Datasources
Posted on 2014-07-15
I need this SQL in LINQ. Note the different databases, db1 & db2.
INSERT INTO db1.tblB
SELECT * FROM db1.tblA db1tA
INNER JOIN db2.tblA AS db2tA
ON db1tA.ColA = db2tA.ColA
The issues really is the JOIN from DB1 to DB2, LINQ does not like multiple DataContexts.
I am thinking I need to do this in 2 passes
First I will select what I need from DB2.tblA using LINQ and place it somewhere?
And then use what I created above and pass into some more LINQ and join to it.
Would this work?
I should say I am new to C# and this is my first bit of LINQ ever, so very much in at the deep end
Thanks in advance