Import data from MS Access to Sql Server via code

1

I need to import data that is in an Access database via code to Sql Server. My software that is made in C # for many years has been integrated into an Access database. From now on we are migrating to Sql Server and the intention is that in the upgrade to the next version the system will only work with Sql Server. I think at first of creating a Sql database with the same names of tables and columns and the software read the Access tables and save the data in the Sql database. Is there any other more practical way to do this via code ?

I've been searching and found just tools ready, but nothing via programming.

    
asked by anonymous 30.11.2017 / 17:34

1 answer

0

What I would do, imagining that your application is local: It would create a synchronization stored procedure in the SQL Database and a LinkedServer for the Access database.

In this Stored Procedure would do the synchronization of the tables taking your access and playing into the SQL, and this procedure would be called through your C # application.

Example of creating LinkedServer for Access in SQL Server.

exec sp_addlinkedserver @server='Access',
@srvproduct='Access',
@provider='Microsoft.Jet.OLEDB.4.0',
@datasrc='c:\test.mdb'
    
03.12.2017 / 12:50