Couple of ways to do this. One is to use the Data Transformation Services (DTS) in SQL Server:
http://www.codeproject.com/useritems/DTS__VBNET_.asp
...and the other would be to use SQL:
Dim ExcelConnection As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & "c:\Test Files\Book20.xls" & ";" & _
"Extended Properties=""Excel 8.0;HDR=No""")
ExcelConnection.Open()
Dim ExcelCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [Orders] FROM [Orders] IN '' [ODBC;Driver={SQL Server};Server=(local);Database=Northwind;Trusted_Connection=yes];", ExcelConnection)
ExcelCommand.ExecuteNonQuery()
ExcelConnection.Close()
|