ADO.NET has been redesigned from earlier versions of ADO to build more-scalable and better-performing data access applications. This section provides a general overview of some of these improvements.
ADO.NET has been designed from the ground up to work with the data while disconnected from the data source. Data is retrieved from the data store and maintained at a local level, within ADO.NET structures. Because the data store doesn’t have to maintain the data cursors or maintain connections while the data is being used by the client, the store can support more client users.
ADO.NET is very tightly integrated with XML. XML is used behind the scenes to maintain the data in datasets and to retain relationships and constraints within the data. In addition, data in ADO.NET can be easily persisted to XML data files for offline usage. In addition, data schemas are maintained in standard XML schemas for use by ADO.NET.
ADO.NET has replaced the concept of recordsets with a new construct called datasets. Datasets greatly expand on the capabilities of recordsets. Recordsets can hold one table of data and are database-centric. Datasets, however, can hold multiple tables of data that can be related, with the relationships known and maintained by ADO.NET. Recordsets can write and read XML data from data streams. Datasets are designed to integrate directly with XML data. In addition, datasets operate with the data completely disconnected from the database but hold changes to the database so that the data can be updated whenever necessary.
To access and manipulate data from the data store, you’ll work through an existing data provider. The .NET data providers link the data store and your application. The .NET Framework includes two data providers for your use, depending on which data store you’ll be accessing, as follows:
OLE DB .NET Data Provider Used to access any OLE DB–compliant data store
SQL Server .NET Data Provider Used to access Microsoft SQL Server 7 or later data stores
Each of the data providers holds an implementation of the following classes, which form the core of the provider:
Connection Used to establish the connection to the data store
Command Used to execute commands on the data store
DataReader Used to access data in a forward-only, read-only form
DataAdapter Used to access data in a read/write form and to manage updates of data
Table 18-1 lists the classes each .NET data provider includes. The OLE DB .NET Data Provider classes are located in the System.Data.OleDb namespace, and the SQL Server .NET Data Provider classes are located in the System.Data.SqlClient namespace.