O'Reilly logo

Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition by David Sceppa

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

Working with DataRelation Objects in Code

You can navigate through multiple tables of data, validate data, aggregate data, and cascade changes using your own code, but you can perform all these functions quickly and easily with the help of the ADO.NET DataRelation object. Let’s look at how to create and use DataRelation objects in code.

Creating DataRelation Objects

The DataRelation class has a few important properties, which you can set in its constructors. When you create a DataRelation, you should provide a name so that you can locate the object in its collection as well as specify the parent and child columns on which to base the relationship. To simplify creation, the DataRelation has separate constructors that accept single DataColumn objects ...

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