Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of VB.NET dataset

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the example analysis of the VB.NET data set. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

1. Basic concept

VB.NET dataset is a kind of offline cache storage data, its structure is the same as database, it has a hierarchical structure of tables, rows and columns, and also includes the constraints and relationships between data defined for the dataset.

Users can create and manipulate datasets through the namespace (NameSpace) of the .net framework.

Users can understand the concept of Dataset through the composition of standards such as properties and collections. Such as:

(1) DataSet includes the Tables collection of data tables and the "Relations" collection of relation.

(2) the DataTable class includes the "Rows" collection of data table row, the "Column" collection of data columns, and the "ChildRelations" and "ParentRelations" collection of data relation.

(3) the DataRow class includes the "RowState" attribute, which is used to show whether the data table has been modified since it was loaded from the database. The values of this attribute can be: "Deleted", "Modified", "New" and "Unchanged".

two。 Defined (Type) and undefined (Untyped) VB.NET datasets

Datasets can be divided into stereotyped and unstereotyped datasets, which are a subclass of the basic DataSet class and contain charts (.xsd files) that describe the structure of the tables owned by the dataset. These chart files include the name and column name of the table, the type information of the data represented by the column, and the constraint relationships between the data. An unstereotyped dataset does not have the description of these charts.

Users can use any two types of datasets in the program. However, the stereotyped dataset can make the user's operation of the data clearer and reduce some unnecessary errors. The stereotyped dataset can generate some object models. The first-class of these models are the tables and columns contained in the dataset. Assume that the user is operating on a stereotyped dataset. You can point to a column with the following syntax.

'point to the title_ id column s=dsPub1.titles (0). Title_id of the titles*** row of the table

But if the user is manipulating an unstereotyped dataset, you need to write code like this:

'point to the title_ id column of the titles*** row of the table

S=dsPubs1.Tables ("titles")

(0) .columns (title_id ")

Using a stereotyped class not only makes it easier to compile the code, but also provides the user with the ability to check whether the code is correct or not, reducing the error rate of the code when pointing to the member values of the dataset.

3. Relational tables (Related Tables) and relational objects (Related Objects)

If the VB.NET dataset contains multiple tables, there may be relationships between these tables. However, unlike a database, the dataset does not have information about associations, so when users are dealing with relational tables, they can create some relations to describe these relationships between the tables in the dataset. The association relationship can be artificially moved from the parent line (parent rows) to the related child line (child rows) through some code. Or return from the child row to the parent row.

Because it is impossible for each teacher to teach only one course, there is an one-to-many relationship between the course description table and the faculty table. For example, suppose teacher i777 (Li Si) teaches two courses, then data data relations can be used to point a specific row of one data table to a column of another data table, so that query navigation can be carried out bidirectionally between the two tables. For example, the user can describe teacher Zhang San's row from one line, browse to the row describing the lesson it teaches, and vice versa. You can also browse from the line describing the course Science999 to the line describing the teacher Zhang San who taught the course.

4. Update VB.NET datasets and data stores

When the user changes the data in the dataset, the changes will be rewritten back to the database. The class "DataRow" is used to operate on individual records, including the attribute "RowState", whose value is used to indicate how the row has changed since the data was called * times from the database. The values of this attribute can be: "Deleted", "Modified", "New" and "Unchanged".

In order to write changes to these datasets back to the database, the user can call 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, will be run.

This is the end of this article on "sample Analysis of VB.NET datasets". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report