Importing Data From MS Access Table to SQL Server Table
-
I am developing an application using VB.Net. On backend I am using MS Access and SQL Server 2005 both. I want to Import data from MS Access table to SQL Server 2005 table using VB.Net. For example, I have a table on MS Access Database name "tblInternship". And I have a table with the same name on SQL Server 2005 Database. Now I want to Import data from Access.tblInternship to SqlServer.tblInternship using Vb.Net. How I can do this. Please send me a code or make me understand to solve this problem.
-
I am developing an application using VB.Net. On backend I am using MS Access and SQL Server 2005 both. I want to Import data from MS Access table to SQL Server 2005 table using VB.Net. For example, I have a table on MS Access Database name "tblInternship". And I have a table with the same name on SQL Server 2005 Database. Now I want to Import data from Access.tblInternship to SqlServer.tblInternship using Vb.Net. How I can do this. Please send me a code or make me understand to solve this problem.
Hi, This can be done in the following manner in SQL query analyzer. --------------------------------------------------------------------- BEGIN CODE -- option 1 INSERT INTO sqltable (field1, field2, field3) SELECT FIELD2, FIELD2, FIELD3 FROM OPENDATASOURCE( 'Microsoft.Jet.OLEDB.4.0', 'Data Source="c:\accessfile.mdb"; User ID=Admin;Password=',tablename) -- option 2 INSERT INTO sqltable (field1, field2, field3) SELECT FIELD2, FIELD2, FIELD3 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','c:\accessfile.mdb';'admin';'', tablename) END CODE --------------------------------------------------------------------- You may try the same thing using VB.Net. I hope this helps :).
Regards, John Adams ComponentOne LLC