Query multiple connections

Forgive me if this has already been asked.... my search did not show up any results.

I was wondering if it's possible to use another connection's DataContext in a query? Please note, I'm not asking to use a linked DB or another one local to the database server. These would be two completely separate databases on different database servers with no database link. I'd like to be able to use C# Statements to query one database, then loop through those results, querying another database on each result. I can do it by making one a SQL connection and using String SQL statements, but obviously I'd rather do both as LINQ statements. Is this possible, and if so, how do I do it?


  • Look at my post last year for a workaround which involves referencing the generated TypedDataContext.dll file from different data sources.


    Not an optimal solution but it is possible.

    Please vote for the linked suggestion on uservoice.
  • Seems like the easiest thing is to create the second data context in a DLL and reference that DLL. I was hoping to have a solution fully-contained in LINQPad but I'll just do the external DLL solution. Thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!