Problem solve Get help with specific problems with your technologies, process and projects.

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 last published in February 2004

Dig Deeper on .NET Framework database programming best practices

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

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

Please create a username to comment.