This section provides a walk-through of writing data access code to Excel in ADO.NET.
Connecting from Code
See Establishing a Connection for the prerequisite information you need to deploy the provider and configure the connection to Excel. Connecting from Code shows how to connect with the classes ExcelConnection, ExcelConnectionStringBuilder, and, in ASP.NET, ExcelDataSource.
You can use the classes detailed in Schema Discovery to discover the table schemas at run time. You can also query the available System Tables to retrieve schema information, data source information, and other data provider metadata.
You can use native ADO.NET interfaces to execute data manipulation SQL to Excel: Querying with the DataReader and Querying with the DataAdapter provide code examples and guides to using native ADO.NET interfaces to access Excel data. Results can be processed from the DataTable instance filled or from the DataReader returned.
Updating the Data shows how to use the provider to update changes to a data set. For examples of the supported SQL syntax, see SELECT Statements, UPDATE Statements, INSERT Statements, and DELETE Statements.
Defining Custom Views
The provider allows you to define virtual tables whose contents are decided by a pre-configured query. See Defining Custom Views for an overview of creating and configuring custom views.
Executing Stored Procedures
You can execute Calling Stored Procedures as parameterized statements or EXEC SQL statements with the ExcelCommand class.
Instantiate pooled connections by configuring the connection string. See Connection Pooling to create and configure a pool.