Browsing multiple related tables in a ado.net dataset (1)

Source: Internet
Author: User
ado| Data Summary: A dataset in Ado.net is a method of representing data in memory, and it can contain multiple related data tables. This article describes how to browse these related data tables in a dataset. You will create a Windows® application in Visual Basic®.net or Visual c#™.net, return related records based on selected records, and generate aggregate information by using an expression as a related record. This article contains links to English-language sites.

Brief introduction
Because datasets can contain several related tables, it is not obvious how to navigate between parent and child records, especially when you are trying to access data in a deep table in the relevant hierarchy.) You will also learn how to browse datasets that contain tables with many-to-many relationships, each of which is associated with each other through Third-party tables (intermediate tables).

The following is an overview of the tasks included in this article:

Create a Windows application project.
Displays a list of the data used as the initial selection.
Returns the records associated with the selected record.
Browse multiple tables and multiple related structures, and access data in the dataset directly at run time.
In addition, this article describes some of the related tasks:

Adds an expression column based on related data for a datasheet.
Generate aggregate information about the related data.
Prerequisite conditions
To fully understand this article, you should have:

Knowledge of basic relational database concepts.
A valid connection to the Northwind sample database so that you can create and run the application.
Generally familiar with ado.net datasets.
Important Data Objects
To use related records in a dataset, you should have a basic understanding of several objects in the. NET Framework System.Data namespaces and how they interact. These objects work together to provide navigation capabilities in a dataset.

The following objects are used to express relationships in a dataset:

DataSet-represents data in memory and can contain multiple DataTable objects that can be associated with a DataRelation object.
DataTable-Represents a complete data table. The schema of the datasheet is defined by the datacolumncollection that make up the table. When two data tables are related, the DataRelation object uses the DataColumn in each table to correlate the data.
DataRelation-Joins multiple tables for browsing records in related tables. When a related record is accessed, the DataRelation object is passed to the GetChildRows or GetParentRow method. The DataRelation object determines the related table to query to return related data associated with the GetChildRows or GetParentRow method call.
DataRow-Represents a separate record of the data. The GetChildRows method and the GetParentRow method used to return related data are members of the DataRow object.
DataColumn-Represents a separate field that, when combined, defines the schema of the DataTable. When two data tables are related, the DataRelation object uses the data columns from each table to correlate the data.

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.