Import Bulk insert of excel into sql

Posted by Oswaldlily under ASP.NET on 9/15/2011 | Points: 10 | Views : 6228 | Status : [Member] | Replies : 2
How to Import excel sheet into sql?

I already exported a excel sheet..Now need to import that into sql..can any1 suggest som ideas?


Posted by: SheoNarayan on: 9/15/2011 [Administrator] HonoraryPlatinum | Points: 25
Posted by: Oswaldlily on: 9/16/2011 [Member] Starter | Points: 25

My error is "Could not find installable ISAM." Look at my followin code..How to solv it..Anythin missin??I m tryin to import excel file to sql

Dim connection As OleDb.OleDbConnection = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source= &FileName& ;ExtendedProperties=""Excel 8.0;HDR=YES;"";IMEX=1;")
Dim command As OleDbCommand = New OleDbCommand("Select * FROM [{0}]", connection)
' Select the data from Sheet1 of the workbook.
Dim myTableName = connection.GetSchema("Tables").Rows(1)("TableName")
Dim da As OleDbDataAdapter = New OleDbDataAdapter(String.Format("SELECT * FROM [{0}]", myTableName), connection)
da.TableMappings.Add("Table", "FO")
Dim ds As DataSet = New DataSet()
return ds

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response