ADO.Net Data Access Model for ASP.Net-Part 1
Introduction to ADO.Net
ADO.Net Framework is the data access model for ASP.Net or .Net based applications. ADO.Net includes the features to access the database from various relational database systems such as SQL Server 2000, SQL Server 2005, and Oracle etc and provides their supported OLE DB and ODBC providers.
ADO.Net includes 2 models to access the data from various data sources:
- Connected Data Access Model
- Disconnected Data Access Model
Connected Data Access Model
ADO.Net provides the classes and data access components to work with database systems. To do some initial tasks you need to create some objects that work in the open connection state of database. These component classes are:
It accepts the connection string to establish the connection between the application and database system.
It executes the supported syntax of command to perform various actions on connected database.
It enables to represent the data retrieved from the data source
Above three classes provide the fundamental features and methods to work with database. They help to connect to a database, execute a command and represent the data retrieved from the database.
Class names used above do not exist they are just used to understand their role in Data Access Model. Actually these classes have their specific name according to the database provider used to access the database.
SqlConnection class, OleDbConnection class, ODBCConnection class, OracleConnection class. These different connection classes are used to connect to the different types of data sources.
ADO.Net Data Providers
ADO.Net includes two categories of data providers:
- Native providers
- Bridge Providers
Native providers such as SQL Server and Oracle that provide high performance due to one less layer between application and database communication. Bridge providers such as OLE DB and ODBC access the database through OLE DB layer or COM.
ADO.Net data providers:
- SQL Server .Net Data Provider: It communicates directly with SQL Server to access the database that uses native data transfer protocol of SQL Server.
- Oracle .Net Data Provider: It enables data access from Oracle data source through Oracle client connectivity.
- OLE DB .Net Data Provider: It communicates with data source through OLE DB layer while data transferring which slightly less efficient than native providers.
- ODBC .Net Data Provider: It used ODBC Driver Manager to communicate with data source by COM interoperability.
All classes, struct and enum etc are included in the corresponding namespaces of different Data Providers
- System.Data.SqlClient: For SQL Server .NET Data Provider types.
- System.Data.OracleClient: For Oracle .NET Data Provider
- System.Data.OleDb: For OLE DB .NET Data Provider types.
- System.Data.Odbc: For ODBC .NET Data Provider types.
- System.Data: For common classes such as DataSet and DataTable.
Continue to next tutorial: ADO.Net Data Access Model for ASP.Net-Part 2 to learn about the disconnected type data access model.