Importing Access Tables

  • Thread starter Thread starter Brian P. Hammer
  • Start date Start date
B

Brian P. Hammer

All - I have the need to import an Access table from one database to another. On my form, I have it set up so the user chooses the source database and the destination database. The table to be imported is set in code.

Anyone have links or code on where I can start? I don't even know where to begin after getting a connection to the databases.

Thanks,
Brian P. Hammer
 
Hi Brian,

You might use an OleDbDataAdapter with SelectCommand (make sure that
AccceptChangesDuringFill is set to false) to fill a DataTable.
Once you have filled DataTable all rows will be marked as Added.
Then use another OleDbDataAdapter with InsertCommand to store data into
another database with Update method.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

All - I have the need to import an Access table from one database to
another. On my form, I have it set up so the user chooses the source
database and the destination database. The table to be imported is set in
code.

Anyone have links or code on where I can start? I don't even know where to
begin after getting a connection to the databases.

Thanks,
Brian P. Hammer
 
Miha - Thanks for your response. I tried this method previously but the table has to exist. My problem is that our provider ships the data in a generic format and then we import it to our SQL. I need to have a table in their database for the relationships to properly setup the table datas for import.

In essence, I need to create a new table and then add the data to this table. We get a new database every 2 months so it would be nice to automate this process. Our database provider will add a table for us for a nominal fee but will get costly.

Thanks,
Brian

--
Brian P. Hammer
"Miha Markic [MVP C#]" <miha at rthand com> wrote in message Hi Brian,

You might use an OleDbDataAdapter with SelectCommand (make sure that
AccceptChangesDuringFill is set to false) to fill a DataTable.
Once you have filled DataTable all rows will be marked as Added.
Then use another OleDbDataAdapter with InsertCommand to store data into
another database with Update method.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

All - I have the need to import an Access table from one database to
another. On my form, I have it set up so the user chooses the source
database and the destination database. The table to be imported is set in
code.

Anyone have links or code on where I can start? I don't even know where to
begin after getting a connection to the databases.

Thanks,
Brian P. Hammer
 
Back
Top