HighTechTalks DotNet Forums  

Re: Connecting to an Excel File

Dotnet Framework (ODBC.net) microsoft.public.dotnet.framework.odbcnet


Discuss Re: Connecting to an Excel File in the Dotnet Framework (ODBC.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Paul Clement
 
Posts: n/a

Default Re: Connecting to an Excel File - 06-24-2004 , 10:11 AM






On Wed, 23 Jun 2004 13:02:01 -0700, "Frans Vander Meiren" <Frans Vander
Meiren (AT) discussions (DOT) microsoft.com> wrote:

¤ Hi
¤
¤ Anyone who can explain me how to load and edit an Excel-file in a DataGrid via an odbcConnection?
¤ Thanks

The following should get you started:

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")

DataGrid1.SetDataBinding(ds, "Sheet8")


Paul ~~~ pclement (AT) ameritech (DOT) net
Microsoft MVP (Visual Basic)

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.