Ask the Expert

How do I get a data control to access information from an Excel spreadsheet?

How do I get a data control to access information from an Excel spreadsheet? I have tried the data form wizard but my book is not clear enough.
Take a look at the MS KB article titled "How-to: Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET."

Basically, it explains that you can use an OleDbConnection component to connect to the Excel workbook, using a connection string like the following:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Book1.xls;Extended
Properties="Excel 8.0;HDR=YES;"

The version of Excel depends on the workbook you're opening, and can be: "5.0" for Microsoft Excel 5.0 and 7.0 (95) and "8.0" for Microsoft Excel 8.0 (97), 9.0 (2000) and 10.0 (2002) workbooks. Once you have a connection to the workbook, you can use a DataAdapter and a Dataset just like against any database.

This was first published in February 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: