Inserting trouble using Premium Edition multiple databases

I cannot figure out how to insert into multiple databases in a single C# Statement file.

For example, I have two dbs connected via connection dialog and can query both dbs perfectly well. Generic names here but the hopefully the concept comes across.

DataContext dc = this;

var query = from a in dc.GetTable<Table1>()
from b in dc.GetTable<XXX.Table2>()
select new {a, b};

What I'm trying to do however is insert into both of these databases. Inserting into the primary db defined in the connection works fine, Table1 above. However, I cannot figure out how to reference a new object for the secondary db, XXX.Table2 above.

// this works fine
var table1 = dc.GetTable<Table1>();
Table1 t = new Table1(){ID = 1};


// this will not show autocomplete, can't find the type to create new

var table2 = dc.GetTable<XXX.Table2>();

// this line is the problem
Table2 t = new XXX.Table2(){ID = 1};



Is it possible to do this with Linqpad? I'm using Premium and assumed that querying multiple dbs would also allow inserting and/or updating them also. If not, would like to request future feature. ;)

Hopefully my examples are readable.

Thanks in advance for any assistance.



  • Options
    I think I found it! There appears to be a XXXTypes property available which will map to the classes I need in the secondary db.


    var table2 = dc.GetTable<XXX.Table2>();
    var myObject = new XXXTypes.Table2(){Id = 1};
    Trying it and hoping it works.
Sign In or Register to comment.