开发者

Copy data from an SQL Server 2005 database to Access 2007 database with a different schema in C#

开发者 https://www.devze.com 2022-12-10 05:09 出处:网络
I have data in an SQL Server 2005 database which I need to copy to an Access 2007 database. It is a database conversion tool. Essentially each table corresponds to a table of a different name and with

I have data in an SQL Server 2005 database which I need to copy to an Access 2007 database. It is a database conversion tool. Essentially each table corresponds to a table of a different name and within each table each column needs to be mapped to a corresponding column in the Access 2007 database.

Just wondering what is the easiest way to acheive this in C#. I would like to write as few SQL statements as possible.

Things I have considered:

  • "INSERT INTO ... VALUES ..." SqlCommands in loops with parameters
  • Filling a DataTable for each table in each database and adding NewRows to the Access table
  • Using DataTableMappings

Essentially I would just like to be able to specify the mappings of source table/columns to destination table/columns and have it perform the conversion automatically.

What I am looking for is the simplest way to achieve this, and if the开发者_如何学JAVAre is a class that does this already.

Thanks.


The easiest way to do this in C# is not to do it in C#. Of course you can, but that is like driving in a nail with a screwdriver. Try SQL Server Integration Services (SSIS). It is made to do this type of data extraction, translation and loading. If you must do it in C#, use C# to shell out to your SSIS package.

0

精彩评论

暂无评论...
验证码 换一张
取 消