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 ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.