471,073 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

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


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


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 1113

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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.