ADO.NET Framework Connected Data Access in ASP.Net

The ADO.NET Framework encompasses a huge number of classes. It really consists of the following three classes:
  • 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.
Most of the other classes in the ADO.NET Framework are built from these three classes. These three classes provide you with the fundamental methods of working with database data. They enable you to connect to a database, execute commands against a database, and represent the data returned from a database.

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 connecting to Microsoft SQL Server 7.0 or higher, you should always use the classes from the SqlClient namespace. These classes provide the best performance because they connect directly to SQL Server at the level of the Tabular Data Stream .

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.
These base classes are contained in the System.Data.Common namespace.
Tags: , , , , , , , , , , , , ,
Hot on Web:


About author