Associating Related Tables with the DataRelation Class
One of the most powerful aspects of ADO.NET—and, specifically, of the DataSet class—is the ability to define relationships between related tables such that both tables can be navigated more easily and efficiently. For example, let's say you have a typical order entry system with both an OrderHeaders and OrderDetails table. In fact, the sample database (ExtendingMFCWithDotNet) provided on the CD with this book contains two such tables whose schemas are shown in Tables 7-2 and 7-3.
Table 7-2. Sample OrderHeaders Table Schema
|Primary Key (y/n)||IDENTITY (y/n)||Column Name||Type|
| || ||CompanyName||varchar|
| || ||ShippingAddress||varchar|
Table 7-3. Sample OrderDetails Table Schema
|Primary Key (y/n)|