This documentation is archived and is not being maintained.

Working with Factories 

The System.Data.Common namespace provides classes for creating DbProviderFactory instances to work with specific data sources. When you create a DbProviderFactory instance and pass it information about the data provider, the DbProviderFactory can determine the correct, strongly typed connection object to return based on the information it has been provided.

Each .NET Framework 2.0 data provider that exposes a DbProviderFactory registers configuration information and a provider string in the machine.config file. Data providers with registered factory classes in the .NET Framework 2.0 include System.Data.Odbc, System.Data.OleDb, System.Data.SqlClient, System.Data.SqlServerCe, and System.Data.OracleClient.

In This Section

Obtaining the DbProviderFactory

Demonstrates how to list the installed data providers and create a DbConnection from a DbProviderFactory.

Creating Commands and Retrieving Data

Demonstrates how to create a DbCommand and DbDataReader, and how to handle data errors using DbException .

Working with a DbDataAdapter

Demonstrates how to use a DbCommandBuilder with a DbDataAdapter to retrieve and modify data.

See Also