Dataset, datatable, dataview

Source: Internet
Author: User
Dataset : Indicates the data cache in the memory.
Namespace: System. Data
ProgramSet: System. Data (In system. Data. dll)
Dataset Is the main component of the ADO. net structure. It is the cache of data retrieved from the data source in the memory. Dataset By a group Datatable Object. Datarelation Objects are correlated. You can also use Uniqueconstraint And Foreignkeyconstraint Object in Dataset To implement data integrity.
Although Datatable The object contains data, Datarelationcollection You can view the table hierarchy. These tables are included in Tables Attribute access Datatablecollection . When accessing Datatable Objects are case sensitive. For example, if Datatable It is named "mydatatable" and the other is named "mydatatable". strings used to search one of the tables are considered case sensitive. However, if "mydatatable" exists and "mydatatable" does not exist, the search string is case-insensitive.
Dataset Data and architecture can be read and written as XML documents. Data and architecture can be transmitted over HTTP and used by any application on any platform that supports XML. Available Writexmlschema Method To save the architecture as an XML architecture, and you can use Writexml Method To save the Architecture and Data.

In a typical multi-layer implementation, it is used to create and refreshDatasetThe steps for updating the original data in sequence include:

  1. PassDataadapterUse data generation and filling in the data sourceDatasetInDatatable.

  2. By adding, updating, or deletingDatarowChange a single objectDatatableObject.

  3. CallGetchangesMethod to create the secondDataset.

  4. CallDataadapterOfUpdateMethod, and the secondDatasetPassed as a parameter.

  5. CallMergeThe method returns the secondDatasetTo merge the changes in.

  6. ForDatasetCallAcceptchanges. Or, callRejectchangesTo cancel the change.

 

Datatable:Indicates a table of data in the memory. 

DatatableIs the core object in the ADO. Net Library. Other usageDatatableIncludingDatasetAndDataview.

When accessingDatatableObjects are case sensitive. For example, ifDatatableIt is named "mydatatable" and the other is named "mydatatable". strings used to search one of the tables are considered case sensitive. However, if "mydatatable" exists and "mydatatable" does not exist, the search string is case-insensitive. OneDatasetIt can contain twoDatatableObjects with the sameTablenameAttribute values and differentNamespaceAttribute Value.

Dataview: Used for sorting, filtering, searching, editing, and navigationDatatableUser-Defined views that can bind data.

DataviewAllows data binding on Windows and web forms.

In addition, you can customize dataview to represent able . This feature allows you to bind to the same datatable , but two controls of different data versions are displayed. For example, a control may be bound to dataview of all rows in the display table, the other control may be configured to display only the rows that have been deleted from datatable . datatable also has defaultview attribute. It returns the default dataview of the table. For example, to create a custom view on a table, go to defaultview sets dataview rowfilter .

To create a data filtering and sorting view, SetRowfilterAndSortAttribute. Then, useItemAttribute returns a singleDatarowview.

Also availableAddnewAndDeleteMethod to add or delete rows from the collection of rows. When using these methods, you can setRowstatefilterAttribute to specify that only deleted rows or new rows can beDataviewDisplay.

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.