Sets the parent row for the child row across this relation.
[Visual Basic] Public Sub SetParentRow( _ ByVal childRow As DataRow, _ ByVal parentRow As DataRow _ ) [C#] public void SetParentRow( DataRow childRow, DataRow parentRow ); [C++] public: void SetParentRow( DataRow* childRow, DataRow* parentRow ); [JScript] public function SetParentRow( childRow : DataRow, parentRow : DataRow );
Exception Type | Condition |
---|---|
RowNotInTableException | One of the rows doesn't belong to a table |
ArgumentNullException | One of the rows is a null reference (in Visual Basic Nothing). |
ArgumentException | The relation doesn't belong to the DataSet object's RelationsCollection. |
InvalidConstraintException | The relation's child DataTable isn't the table this row belongs to. |
[Need explanation of why we do this.]
The following example sets the parent row of a given child row.
[Visual Basic]
Private Sub SetParent() Dim childRow As DataRow Dim parentRow As DataRow ' Get a ParentRow and a ChildRow from a DataSet. childRow = DataSet1.Tables("Orders").Rows(1) parentRow = DataSet1.Tables("Customers").Rows(20) ' Set the parent row of a DataRelation. DataSet1.Relations("CustomerOrders").SetParentRow(childRow, parentRow) End Sub
DataRelation Class | DataRelation Members | System.Data Namespace