Creating a Data Relation in Code
This chapter's final example will relate the data in two tables of the pubs example database—publishers and titles—together using the shared pub_id field to create a master/detail data application. This example will display publishers' names in a list box as you see in Figure 10.6 (the “master” part). When the users select a publisher, the code will display that publisher's books in a data grid (the “detail” part). To do this, we'll create a DataRelation object in code.
Figure 10.6. The ch10_05 example.
Datasets just hold your data in tables—they don't know anything about the relations between those tables. To ...