Comparison between ADO and ADO. net

Source: Internet
Author: User

You can compare the functions of ADO. Net with the specific functions of ActiveX Data Object (ADO) to understand the functions of ADO. net.

Memory representation of data

In ADO, the data in memory is represented as a record set. In ADO. net, it is a dataset. There are important differences between them.

Number of tables

The record set looks like a single table. If a record set contains data from multiple database tables, it must use join queries to combine data from each database table into a single result table.

Instead, a dataset is a set of one or more tables. Tables in a dataset are called data tables. Specifically, they are able objects. If a dataset contains data from multiple database tables, it usually contains multipleDatatableObject. That is, eachDatatableObjects usually correspond to a single database table or view. In this way, the dataset can mimic the structure of the basic database.

A dataset usually contains links. The relationships in a dataset are similar to foreign key relationships in a database, that is, they associate rows in multiple tables. For example, if the dataset contains a table about the investor and another table about the stock purchase of each investor, the dataset may also contain a relationship to connect the rows in the investor table and the corresponding rows in the purchase table.

Since a dataset can store multiple independent tables and maintain information about the relationship between tables, it can store a much richer data structure than a record set, including Self-associated tables and tables with many-to-many relationships.

Data navigation and cursors

In ADO, you use ADOMovenextThe method sequentially scans rows in the record set. In ADO. net, rows are represented as sets. Therefore, you can access specific rows through tables in sequence, or through sequence number indexes or primary key indexes.DatarelationThe object maintains information about the master record and detailed data record, and provides methods for you to obtain records related to the records being operated. For exampleInvestorThe table's "Nate sun" Row starts and can be locatedPurchaseThe group of rows that describe the purchase status in the table.

A "cursor" is a database element that controls record navigation, data update capabilities, and other users' visibility into database changes. Ado. Net does not have an inherent cursor object, but contains a data class that provides the traditional cursor function. For exampleDatareaderObject. For more information about the cursor function, see data access technology.

Minimize the connection opening time

In ADO. net, the connection is only available for database operations, such as select or update ). You can read rows into a dataset and use them without retaining the connection to the data source. In ADO, record sets can provide non-connection access, but ADO is mainly designed for connection access.

There is a significant difference between non-connection processing in ADO and ADO. net. In ADO, by calling ole dbProgramTo communicate with the database. However, in ADO. net, you use the data adapter (oledbdataadapter, sqldataadapter, odbcdataadapter, or oracledataadapter object) to communicate with the database, which calls the APIS provided by the ole db provider or basic data source. ADO and ADO. the main difference between them is: In ADO.. net, the data adapter allows you to control how changes made to the dataset are transmitted to the database by optimizing performance, performing data verification checks, or adding any additional processing.

Note:Data adapter, data connection, data commands, and data reader are components that constitute the. NET Framework data provider. Microsoft and third-party vendors may provide other providers that can also be integrated into Visual Studio. For information about different. NET data providers, see. NET data providers.

Share data between applications

It is much easier to transmit ADO. Net datasets between applications than to transmit records that are not connected by ADO. To transmit a record set that is not connected to ADO from one component to another, use Com. To transmit data in ADO. net, use a dataset that can transmit XML streams.

Compared with COM, XML file transmission provides the following convenience:

Richer Data Types

Com mail provides a set of limited data types (those defined by the COM standard ). Since datasets in ADO. NET are transmitted in XML format, there are no restrictions on data types. Therefore, components that share datasets can use any rich data type set that these components generally use.

Performance

Transfers large ADO Record Sets or large ADO. NET data sets to use network resources. As the data volume increases, the network pressure is also increasing. Both ADO and ADO. Net allow you to minimize the amount of data transmitted. However, ADO. Net also provides another performance advantage: Ado. Net does not require data type conversion. However, if you want to use com to encapsulate ado that sends records between components, You need to convert the ADO data type to the com data type.

Penetration Firewall

The firewall can affect two components that attempt to transmit unconnected ADO record sets. Remember that the firewall is usually configured to allow HTML text to pass, but to prevent system-level requests (such as com mails) from passing through.

Because components use XML to exchange ADO. Net databases, the firewall can allow data sets to pass through.

Author's blog:Http://blog.csdn.net/chenkangli/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.