468,140 Members | 1,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,140 developers. It's quick & easy.

copy dataset1(db1) to dataset2(db2) and send back dataset2 to db2.

hi,

i am trying to achieve this:

i have 2 different databses. i need to get data from one databse (for eg. in a datset), copy it into another dateset (pointing to the second database), make changes and send the results back to second databse.

i tried to use the ds.copy() method, using something like this:

DataSet ds;
strConn = " first databse";
strSQL = " Select * from table1 "; // in first database

OracleConnection connection = new OracleConnection(strConn);
OracleDataAdapter adapter = new OracleDataAdapter();


adapter.SelectCommand = new OracleCommand(strSQL, connection);
adapter.Fill(ds, "MyTable");

DataSet ds1 = new DataSet();


ds1 = ds.Copy();


DataTable dt = new DataTable("T1");
dt = ds1.Tables[0];

strConn1 = " second databse";
OracleConnection connection = new OracleConnection(strConn1);
OracleDataAdapter adapter1 = new OracleDataAdapter();

adapter1.SelectCommand= new OracleCommand("" Select * from table2 where 1=2 "; ", connection); // in second database


adapter1.Fill(dt);
adapter1.Update(dt);


the dicey part is when i am trying to assign a select command to adapter1 by saying "create an SQL with no rows (1=2) ", but then fill the adpater1 from the dt obtained from dataset1. All this so that i can avoid a row by row insert into db2, and send the ds in one shot (bulk, using Oracle only.)

Maybe theres another approach to do bulk insert in Oracle(using c# ) ? what do you guys think??
Aug 16 '07 #1
0 1042

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Firehawk® | last post: by
4 posts views Thread by Laurence | last post: by
1 post views Thread by aagarwal29 | last post: by
6 posts views Thread by crack.the.hack | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.