Excel to Dataset?

  • Thread starter Thread starter Akhil
  • Start date Start date
You can use ADO.Net and use the Excel Driver to load data from the Excel
sheet into the dataset.
 
I used this and got an error as "Unknow provider in connection object"

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source=" & strPostedFileName & ";" & _

"Extended Properties=Excel 8.0;"
 
On Fri, 13 Aug 2004 10:25:10 +0530, "Akhil" <asdads> wrote:

¤ Hi All,
¤
¤ How to import data from Excel to dataset?
¤ Code please,if Possible.

Dim ConnectionString As String

ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=e:\My Documents\Book20.xls;Extended Properties=""Excel 8.0;HDR=NO"""

Dim ExcelConnection As New System.Data.OleDb.OleDbConnection(ConnectionString)
ExcelConnection.Open()

Dim da As New System.Data.OleDb.OleDbDataAdapter("Select * from [Sheet8$]", ExcelConnection)
Dim ds As New DataSet("Workbooks")

da.Fill(ds, "Sheet8")

Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top