Copy tables from Oracle to Access FAST?

T

Troy McLure

I have used the code below to copy data from one Access file to another
Access file, and it's seems to be pretty fast. When the source tables
are in Oracle and using an OracleConnection as source, my insertstring
won't work anymore. Will I have to start filling datasets, traverse the
rows and copy each field in for-loops? Won't that be terribly slow? Is
there a faster way?

//Destination Access file exists and has the same tablenames and
fieldnames as the source, so:
OleDbConnection conSrc =
new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"+
"data source=" + @"c:\source.mdb" );
conSrc.Open();
string insertstring = @"INSERT INTO tablename IN "c:\destination.mdb"
SELECT * FROM tablename";
OleDbCommand cmd = new OleDbCommand(insertString, conSrc);
cmd.ExecuteNonQuery();
 
P

Paul Clement

¤ I have used the code below to copy data from one Access file to another
¤ Access file, and it's seems to be pretty fast. When the source tables
¤ are in Oracle and using an OracleConnection as source, my insertstring
¤ won't work anymore. Will I have to start filling datasets, traverse the
¤ rows and copy each field in for-loops? Won't that be terribly slow? Is
¤ there a faster way?
¤
¤ //Destination Access file exists and has the same tablenames and
¤ fieldnames as the source, so:
¤ OleDbConnection conSrc =
¤ new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"+
¤ "data source=" + @"c:\source.mdb" );
¤ conSrc.Open();
¤ string insertstring = @"INSERT INTO tablename IN "c:\destination.mdb"
¤ SELECT * FROM tablename";
¤ OleDbCommand cmd = new OleDbCommand(insertString, conSrc);
¤ cmd.ExecuteNonQuery();

The following SQL string works for me (connect to the Access database not Oracle):

INSERT INTO [AccessTable] SELECT * FROM [OracleTable] IN '' [ODBC;Driver={Microsoft ODBC For
Oracle};Server=OracleServer;Uid=userid;Pwd=password;]


Paul
~~~~
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top