|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Display Related Data in a Windows Application
You can display related data by dragging items that share the same main table node from theonto your form. For example, if you have a data source that has a Customers table and a related Orders table, you would see both tables as top-level nodes (in the tree view) in the Data Sources window. Expand the Customers node so that you can see the columns, and you will notice that the last column in the list is an expandable node representing the Orders table. This node represents the related orders for a customer. This means that if you want to create a form that allows you to select a customer and then display a list of orders for that customer, you would drag the items you want to display from this single hierarchy.
To create controls that display related records
Open your form in the.
Open the Data Sources window. For more information, see.
Expand the node representing the parent table in the relationship. (The parent table is the table on the "one" side of a one-to-many relationship.)
Drag any items you want to display from the parent table in the relationship from the Data Sources window onto your form.
Related child tables appear as expandable nodes at the bottom of the parent table's column list. Drag the item(s) that you want to display from such a related node onto your form.
Dragging an item from a top-level nodes creates a separate unrelated BindingSource Component that does not facilitate navigating the related records. To bind related data you must select the tables from the same hierarchical node.