- Connection : Enables you to represent a connection to a data source.
- Command : Enables you to execute a command against a data source.
- DataReader : Enables you to represent data retrieved from a data source.
The importance of these three classes, it’s safe to tell you that they don’t really exist. ADO.NET uses the Provider model. You use different sets of ADO.NET classes for communicating with different data sources.
The different implementations of the Connection, Command, and DataReader classes are grouped into the following namespaces:
- System.Data.SqlClient : Contains ADO.NET classes for connecting to Microsoft SQL Server version 7.0 or higher.
- System.Data.OleDb : Contains ADO.NET classes for connecting to a data source with an OLEDB provider.
- System.Data.Odbc : Contains ADO.NET classes for connecting to a data source with an ODBC driver.
- System.Data.OracleClient : Contains ADO.NET classes for connecting to an Oracle database (requires Oracle 8i Release 3/8.1.7 Client or later).
- System.Data.SqlServerCe : Contains ADO.NET classes for connecting to SQL Server Mobile.
If you are communicating with an Oracle database, you should use the classes from the OracleClient namespace. If you are communicating with another type of database, you need to use the classes from either the OleDb or Odbc namespaces. Just about every database ever created has either an OLEDB provider or an ODBC driver.
Because ADO.NET follows the Provider model, all implementations of the Connection, Command, and DataReader classes inherit from a set of base classes. Here is a list of these base classes:
- DbConnection : The base class for all Connection classes.
- DbCommand : The base class for all Command classes.
- DbDataReader : The base class for all DataReader classes.