I add a DataRelation to a DataSet as following
DataRelation dr = new DataRelation("relation", parentTablePrimaryKeyColumns,
childTablePrimaryKeyColumns);
myDataSet.Relations.Add(dr);
The parant table and child table has a one-one relation. When I call
myParentTable.Clear(), I got the error:
System.Data.InvalidConstraintException : Cannot clear table myParentTable
because ForeignKeyConstraint relation enforces constraints and there are
child rows in myChildTable.
I checked the DeleteRule and it was Rule.Cascade. So I assumed the records
in child table should have been removed automatically.
Why?