Monday, September 5, 2011

Connection String for .xls and .xlsx

MyConnection = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0; Data Source='" & G_FilePath & "'; Extended Properties=Excel 8.0;")
Else
MyConnection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & G_FilePath & "';Extended Properties=""Excel 12.0;HDR=Yes;IMEX=2""")
End If

No comments:

Post a Comment