ADO.NET Getting Started (3)

zhaozj2021-02-16  48

3.Dataset, DataTable, and Recordset

About RecordSet Object., ADO.NET does not correspond to it directly. The closer is the DataTable object. Although they almost have the same function, they play different roles in their respective frameworks.

Recordset is a considerable object that has most features of ADO, but there is still a lack in some respects. Recordset is excellent in some aspects, such as: it can be creative, it can operate offline, but in some aspects It still needs to be improved, such as: Based on its inherent COM characteristics, RecordSet is difficult to serve on the network; Recordset is a binary object, so the modules between different platforms are difficult to share; and there is a snake that cannot pass through the firewall. In addition, it performs a single table of records. If the table is the result of one or a few join, it is difficult to update the original code source. When you try to unite the line of RECORDSET with the original code source, the data source You must be able to identify SQL. No matter what, your Recordset can be created by a non-SQL provider.

In ADO.NET, all features of Ado Recordset are separated into several simpler objects: one of them is DataReader. DataReader simulates the operation of fast, read-only, forward read-only cursors.

DataTable, a data source is a simple object. You can manually construct a DataTable, or you can use the DataSet command to generate. DataSet is not much better for the data it contains. By it, you can process data in memory, Or others such as sorting, editing, filtering, create browsing, etc.

The DataSet object is a data container class that is a key object that implements ADO.NET data. DataSet sets one or several DataTable objects. DataTable, through such a general collection, public content. When you try from data When you read the data, you may not pass two different levels: DataTableMapping and DataView.

The DataTableMapping object contains the data columns in the data source, as well as the mapping relationship between DataTable Object.

When populating DataSet, the DataSetCommand object uses this class. It maintains links between the abstract columns in the data set and the physical columns in the data source.

The view of the table is implemented by a DataView object. It represents a custom view of a DataTable that can be bound to a specific control (such as a Windows Form and a data grid in a web form). This object is equivalent to the implementation of the SQL CREATE VIEW statement in memory.

All tables in the DataSet can be associated with each other through a common domain. The links between them are managed by the DataRelelation object. This is quite like ADO's data, but there is a maximum difference.

In DataRelation, you don't need to use data to form language, and you can also get a very flexible organizational architecture. Through the ADO .NET navigation model, you can easily move from the primary bank in a table to all of its sub-lines.

Dataralation Object is the implementation of the JOIN statement in memory, which can be used to establish the same Parent / Child relationship of the same data type. Once the relationship is established, any modification of this relationship is disabled. Views and rates are completed Master / Detail architecture Two methods. Please remember that the view is only loaded on the record above the record, but the RELATION

It is a dynamic link between several columns. Under the relation, you cannot change the order or set the condition.

If your code requires 1 pair of foreign key relationships, and change data, it is best not to use the Join command. If you need additional filtering, you can seek support for ADO .NET custom views.

转载请注明原文地址:https://www.9cbs.com/read-23556.html

New Post(0)