The concept of a vb.net dataset (datasets)

Source: Internet
Author: User
Tags one table first row

1. Basic Concepts
A DataSet is an off-line cache-storing data that, like a database, has a hierarchy of tables, rows, columns, and also includes constraints and associations between data defined for a dataset. The
user can pass. NET Framework's namespace (NameSpace) to create and manipulate datasets.
Users can understand the concept of a dataset through the composition of these standards, such as attributes (properties), Collections (collections). For example, a
(1) dataset contains tables of data tables and a collection of relation "Relations". The
(2) DataTable class includes a "Rows" collection of data table row, a "Column" collection of data columns, and a collection of "ChildRelations" and "parentrelations" for data relation. The
(3) DataRow class includes the "RowState" property, which is used to display whether the data table has been modified for the first time since the database was loaded, and the value of this property can be: "Deleted", "Modified", "New", and "unchanged".
2. Definition (Type) and undefined (untyped) datasets

Datasets are both stereotyped and unformed, and the stereotyped dataset is a subclass of the basic dataset class and contains a chart (. xsd file) that describes the structure of the tables owned by the dataset. These chart files include the name and column names of the table, the type information of the data that the column represents, and the constraint relationships between the data. An amorphous dataset does not have a description of these graphs.
In a program, users can use any two types of data sets, however, a set of data sets can make the user more aware of the operation of the data, and can reduce some unnecessary errors, the stereotypes of the dataset can generate some object models, these models of the first level of class (first-class) is the tables and columns that the dataset contains, and assuming that the user is manipulating a set of data sets, you can point to a column with the following syntax.
' title_id column pointing to the first row of table titles
S=dspub1.titles (0). title_id
But if the user is manipulating an amorphous dataset, this code is needed:
' title_id column pointing to the first row of table titles
S=dspubs1.tables ("titles") (0). Columns (title_id ")
Not only does using a stereotype class make code easier, but the syntax of this stereotype also provides users with the ability to check the code correctly, reducing the error rate of the code when pointing to a DataSet member value.
3. Relational tables (Related tables) and relational objects (Related Objects)
If the dataset contains more than one table, and the tables may have associated relationships, but the dataset does not resemble the database, it does not have information about the associated relationship, so when the user is working on the relational table, some associations can be created (relations) To describe the associations between the tables in the dataset. The association relationship can be passed through some code, artificially from parent rows to related Zikong (child rows). Or you can return to the parent row from a child row.
For example, here's an example of a school curriculum that has a table for teachers, like the following table:

The dataset may also include another table about course information, which includes the teacher's ID and takes it as an external constraint key (foreign key), as in the following table:

Since each teacher cannot teach only one course, there is a one-to-many relationship between the curriculum description table and the instructor's table. For example, suppose that a teacher i777 (Dick) teaches 2 subjects, you can use the Data Association (information relations) to point a particular row of a datasheet to a column in another datasheet, so that you can query navigation between the tables in two directions, for example, The user can view the line describing the John teacher from a single line and browse to the line that describes the lesson it teaches, or, alternatively, from the line describing the course Science999 (biology) to the teacher John who describes the teaching.
4. Updating datasets and data storage
When the user changes the data in the dataset, these changes will be written back to the database, and class "DataRow" is used to manipulate individual records, including the attribute "RowState", which is used to indicate how the row changed since the first time the data was called from the database. The value of this property can be: "Deleted", "Modified", "New", and "unchanged".
In order to write the changes of these datasets back to the database, the user can invoke the method "Update", which will access the property value of "RowState" and decide how to perform a series of operations on the database, such as Add,edit,delete, which will be run.

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.