Comparing ADO.NET and ADO


Prior to ADO.NET, ADO was the most popular and powerful Microsoft data access technology. So, how does ADO.NET improve on ADO? To understand the power of ADO.NET, it's not a bad idea to compare ADO.NET with ADO.

The ADO.NET model is inherited from its predecessor ADO, but there are some key differences between ADO and ADO.NET. The following sections describe these differences.

Connections and Disconnected Data

With ADO.NET, you use as few connections as possible and have more disconnected data. In fact, it's recommended to use disconnected data in ADO.NET. In ADO.NET, disconnected data is stored in the form of in-memory DataTable or XML DataSet objects. Having disconnected data not only reduces the load and resource consumption on the server and network, but it also provides better performance.

The ADO.NET DataSet not only supports disconnected data, but it provides rich features in comparison to an ADO recordset. A DataSet, which is a collection of DataTable objects, can store data, but it can also store database table schemas and the relationship between multiple tables.

Recordsets vs. DataSets

In ADO, the in-memory representation of data is the recordset. A recordset is a set of records that can be an entire database table, a section of a table, or a join of more than one table. You use SQL statements to return the set of data. You use a recordset's MoveNext, MovePrevious, MoveFirst, and MoveLast methods to navigate through the data.

Note

Even though there's no support of move methods in a DataSet, you can implement them using data binding. We discuss data binding in more detail in Chapter 7.

In ADO.NET, the recordset is gone. The new objects introduced in ADO.NET that serve the purpose of the recordset are the DataSet and DataReader. A DataSet object represents a DataSet, and a DataReader object represents a DataReader in ADO.NET. A DataSet is a collection of one or more than one table. A DataSet can also contain metadata of database tables, such as their relationships, constraints, and primary and foreign keys. A DataTable object represents a table of a DataSet. With the help of the DataView object, you can have multiple views of the same DataSet.

A DataSet doesn't have any move methods to navigate through DataSet records like a recordset does. In ADO.NET, a DataTable is a collection of DataRows. You use a DataRow object to navigate through the records. ADO.NET also provides DataRelation objects to navigate through master and detail records using primary and foreign keys. The DataReader object provides fast-cached, forward-only data to read data and navigate through its records.

XML Support

The ADO.NET model uses XML to store and transfer data among applications, which is not only an industry standard but also provides fast access of data for desktop and distributed applications. ADO uses COM marshaling to transfer data among applications, which is not only hard to program but also not as efficient or reliable as XML because of its limitations, its data types and their conversions, and the nature of COM. Using XML, it's easy to program XML files, and you can also transfer data through firewalls using HTTP, which isn't possible using COM marshaling.




Applied ADO. NET(c) Building Data-Driven Solutions
Applied ADO.NET: Building Data-Driven Solutions
ISBN: 1590590732
EAN: 2147483647
Year: 2006
Pages: 214

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net