DataRow.SetParentRow Méthode

Définition

Définit la ligne parente de DataRow.

Surcharges

SetParentRow(DataRow)

Définit la ligne parente de DataRow avec le nouveau DataRow parent spécifié.

SetParentRow(DataRow, DataRelation)

Définit la ligne parente de DataRow avec les nouveaux DataRow et DataRelation parents spécifiés.

SetParentRow(DataRow)

Définit la ligne parente de DataRow avec le nouveau DataRow parent spécifié.

public:
 void SetParentRow(System::Data::DataRow ^ parentRow);
public void SetParentRow (System.Data.DataRow? parentRow);
public void SetParentRow (System.Data.DataRow parentRow);
member this.SetParentRow : System.Data.DataRow -> unit
Public Sub SetParentRow (parentRow As DataRow)

Paramètres

parentRow
DataRow

Nouveau DataRow parent.

S’applique à

SetParentRow(DataRow, DataRelation)

Définit la ligne parente de DataRow avec les nouveaux DataRow et DataRelation parents spécifiés.

public:
 void SetParentRow(System::Data::DataRow ^ parentRow, System::Data::DataRelation ^ relation);
public void SetParentRow (System.Data.DataRow? parentRow, System.Data.DataRelation? relation);
public void SetParentRow (System.Data.DataRow parentRow, System.Data.DataRelation relation);
member this.SetParentRow : System.Data.DataRow * System.Data.DataRelation -> unit
Public Sub SetParentRow (parentRow As DataRow, relation As DataRelation)

Paramètres

parentRow
DataRow

Nouveau DataRow parent.

relation
DataRelation

Relation DataRelation à utiliser.

Exceptions

Une des lignes n'appartient pas à une table

Une des lignes est null.

La relation n'appartient pas au DataRelationCollection de l'objet DataSet.

Le DataTable enfant de la relation ne correspond pas à la table à laquelle appartient cette ligne.

Exemples

L’exemple suivant définit la ligne parente d’une ligne enfant spécifique.

Private Sub SetParent()
    ' Get a ParentRow and a ChildRow from a DataSet.
    Dim childRow As DataRow = _
        DataSet1.Tables("Orders").Rows(1)
    Dim parentRow As DataRow = _
        DataSet1.Tables("Customers").Rows(20)

    ' Set the parent row of a DataRelation.
    childRow.SetParentRow(parentRow, _
        DataSet1.Relations("CustomerOrders"))
End Sub

S’applique à