Sep 5th, 2011, 04:17 PM
Excel reading sheets and ranges using OleDb
The attached VS2008 solution contains three projects, which demonstrates how to read MS-Excel data using OleDb. There are two library projects, which contain language extension methods for BindingSource and OleDb, which are exposed publically so that they can be used in other projects.
In the windows forms project there are four DataGridView controls, which obtain data from opening an Excel file via a language extension method, which is overloaded and uses enumerations to create a connection string for working with data as a DataTable. There are two variations of opening a worksheet then another variation of opening a range as a range and as a named range.
In the Excel OleDb library, there are several functions, which return all sheet names, all objects, which can be opened into a DataTable, and a function, which returns only, named ranges.
The BindingSource library is not specific to working with Excel data. Intertwined in the Excel operations several of the BindingSource extension methods are demonstrated.
Tags for this Thread
Click Here to Expand Forum to Full Width