sql server - Inner Join two databases to import data - SQL C# -
i've created winforms app in c#. have both datasources listed datasets.
- lotsdataset = source info
- webbitdbdataset = destination dataset.
these connected lotsconnectionstring
, webbitconnectionstring
.
anyway have code shown below getting connection error on, when try import data lots webbit.
sqlconnection lotscon = new sqlconnection(packchecker.properties.settings.default["lotsconnectionstring"].tostring()); using (oledbconnection con = new oledbconnection(packchecker.properties.settings.default["webbitconnectionstring"].tostring())) { string strgetloc = @"insert tblinstitution ( dispenseinstid, institutionname ) select newinstitution.institutionid, newinstitution.institutionname newinstitution left join tblinstitution on newinstitution.institutionid = tblinstitution.dispenseinstid (((tblinstitution.institutionid) null));"; using (oledbcommand cmd = new oledbcommand(strgetloc, con)) { lotscon.open(); con.open(); cmd.executenonquery(); con.close(); lotscon.close(); } }
trying "open connection" both connections tried.. guess knowing going fail, wanted try before asked on here.
the command attached oledb connection webbit, i'm getting exception based on 'cannot find lots server'
prior running query run connection checker, opens both connections , "tries , catches" both connections make sure valid connections.
using access query work, know issue 100% trying open these connections 2 databases!
any direction appreciated. gangel
Comments
Post a Comment