ado和ado.net比较

来源:互联网 发布:龙阳路枢纽路网优化 编辑:程序博客网 时间:2024/04/28 03:12
FeatureADOADO.NET
Memory-resident data representationUses 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 tablesRequires 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 visitationScans 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 accessProvided 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.
CursorsUtilizes server-side and client-side cursors.The architecture is disconnected so cursors are not applicable.
ProgrammabilityUses 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 componentsUses 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 firewallsProblematic, 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.
ScalabilityDatabase 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.
原创粉丝点击