Last post Jul 07, 2015 09:49 PM by Li Wang
Jul 07, 2015 06:11 AM|tech_m|LINK
I need C# Code to Import Schema and Data of MS Access to MS Sql 2008 R2.
Thanks in Advance
Jul 07, 2015 07:19 AM|PatriceSc|LINK
This is something you want to do programmatically and repeatidly or is this a one time operation? You could try
https://msdn.microsoft.com/en-us/library/hh313041(v=sql.110).aspx (a wizard) or you'll have to use
https://msdn.microsoft.com/en-us/library/ms135981(v=vs.110).aspx to get the schema information, create SQL Side tables, import them etc... (you likely won't find a single command
doing that, you'll have to code this).
Some more details about your context could help.
Jul 07, 2015 09:49 PM|Li Wang|LINK
Thank you for your post.
According to your description, there are a lot of work to do.
Step 1, load schema of access, you could use GetOleDbSchemaTable method, link below is for your reference.
Step 2, create database in sql server according schema table generated from step 1. You have to build lots of sql create statement.
Step 3, retrieve data from access, you could use OleDb to fix it.
Step 4, insert data which is retrieved from access to sql server. You could use sqlcommand to insert data.
Hoping my reply could be helpful to you.