Excel to Dataset?

  • Thread starter Thread starter Akhil
  • Start date Start date
A

Akhil

Hi All,

How to import data from Excel to dataset?
Code please,if Possible.
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top