2
Reply

Copy a table from Access to SQL Server

Dong Liu

Dong Liu

May 18 2005 10:27 AM
3.1k
I tried to copy a table from Access to SQL Server through ADO.NET. I thought .Net should have a class or a function in Class like OleDbDataAdapter to do it with one single call. I could not find out such an approach in .Net built in functions. The first manual approach I tried is using OleDbDataAdapter's fill function to get the DataTable from Access and then employing SqlDataAdapter's update function to push the table to SQL Server. It seems that nothing happens. The way I am doing right now is using OleDbDataAdapter to get the DataTable object, then the DataColumn object, and manually extract the table structure and data row by row. SqlConnection is created to insert into SQL Server, and manually covert the System.Type in DataColumn object into SqlDbType in a long switch function. I am not sure I need to do that much in .NET platform for table copy between these two Microsoft database products. Is there an easy way to do this? Thanks for your input!

Answers (2)