Hi

I would like to get the connection string for both 2003 excel (*.xls) and 2007 excel (*.xlsx). I want to read both files depends upon the selection.

When I was using this code

Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & a_sFilepath & ";Extended Properties= Excel 8.0;HDR=YES;")

I get an oleDB exception "Could not find installable ISAM" and also I would like to know wheather we can use same connection string for both .XLS and *.XLSX

hi..try this connection string...

Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
                MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & filepath & "';Extended Properties=Excel 8.0;")
                MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", MyConnection)

Try this below .to how to import excel file to database
[snipped blog promo]

commented: why you need to post the blog link -3

Hi thanks got it

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.