Sunday, August 26, 2007

ADO.net > Creating a DataRelation

CREATING A DATARELATION
• DataRelations are exclusively in-memory objects that must be created explicitly with code
• Following code sets up a relation based on column ‘empID’

DataColumn c1 = tableEmp.Columns(“empID”);
DataColumn c2 = tableOrd.Columns(“empID”);
DataRelation rel = new DataRelation(“Emp2Orders”, c1, c2);
DataSet.Relations.Add(rel);

No comments: