O'Reilly logo

Extending MFC Applications with the .NET Framework by Nishant Sivakumar, Tom Archer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 NameType
YESYESOrderIdint
  CompanyNamevarchar
  ShippingAddressvarchar
Table 7-3. Sample OrderDetails Table Schema
Primary Key (y/n)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required