ADO和ADO.NET的比较
Feature
ADO
ADO.NET
Memory-resident data representation
Uses the RecordSet object, which looks like a single table.
Uses the DataSet object, which can contain one or more tables represented by DataTable objects.
Relationships between multiple tables
Requires the JOIN query to assemble data from multiple database tables in a single result table.
Supports the DataRelation object to associate rows in one DataTable object with rows in another DataTable object.
Data visitation
Scans RecordSet rows sequentially.
Uses a navigation paradigm for non-sequential access to rows in a table. Follows relationships to navigate from rows in one table to corresponding rows in another table.
Disconnected access
Provided by the RecordSet but typically supports connected access, represented by the Connection object. You communicate to a database with calls to an OLE DB provider.
Communicates to a database with standardized calls to the DataAdapter object, which communicates to an OLE DB provider, or directly to SQL Server.
Cursors
Utilizes server-side and client-side cursors.
The architecture is disconnected so cursors are not applicable.
Programmability
Uses the Connection object to transmit commands that address underlying data structure of a data source.
Uses the strongly typed programming characteristic of XML. Data is self-describing because names for code items correspond to the "real world" problem solved by the code. Underlying data constructs such as tables, rows, and columns do not appear, making code easier to read and to write.
Sharing disconnected data between tiers or components
Uses COM marshalling to transmit a disconnected record set. This supports only those data types defined by the COM standard. Requires type conversions, which demand system resources.
Transmits a DataSet as XML. The XML format places no restrictions on data types and requires no type conversions.
Transmitting data through firewalls
Problematic, because firewalls are typically configured to prevent system-level requests such as COM marshalling.
Supported, because ADO.NET DataSet objects use XML, which can pass through firewalls.
Scalability
Database locks and active database connections for long durations contend for limited database resources.
Disconnected access to database data without retaining database locks or active database connections for lengthy periods limits contention for limited database resources.