Easy- From Excel to Table in Database
Hi !
I've found an easy way to import data from excel file to a table in sql server 2000.
Code:
Dim excelConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\file.xls;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1';")
excelConnection.Open()
Dim ExcelCommand As New System.Data.OleDb.OleDbCommand("INSERT INTO [ODBC;Driver={SQL Server};Server=Servername;Database=databasename;Uid=username;Pwd=password].[tablename] SELECT * FROM[sheet1$];", excelConnection)
ExcelCommand.ExecuteNonQuery()
excelConnection.Close()
Comments and suggestions are welcome
Re: Easy- From Excel to Table in Database