Junior ADO.NET

What is a DataRelation in ADO.NET, and how do you use it?

A DataRelation defines a relationship between two DataTable objects in a DataSet. It is

used to enforce referential integrity and allows for navigating between related data in a

parent-child relationship.

Example:

DataRelation relation = new DataRelation("ParentChild",

parentTable.Columns["ID"], childTable.Columns["ParentID"]);

dataSet.Relations.Add(relation);

More from ADO.NET Core Tutorial

All questions for this course