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.
Hopefully my examples are readable.
Thanks in advance for any assistance.
-steve
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.
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.
DataContext dc = this;
var query = from a in dc.GetTable<Table1>()
from b in dc.GetTable<XXX.Table2>()
select new {a, b};
query.Dump();
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.
// this works fine
var table1 = dc.GetTable<Table1>();
Table1 t = new Table1(){ID = 1};
table1.InsertOnSubmit(t);
dc.SubmitChanges();
/**************************************************/
// 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};
//
table2.InsertOnSubmit(t);
dc.SubmitChanges();
Hopefully my examples are readable.
Thanks in advance for any assistance.
-steve
Comments
E.g.) Trying it and hoping it works.