Lire en anglais

Partager via


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)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

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

C#
public void SetParentRow (System.Data.DataRow? parentRow);
C#
public void SetParentRow (System.Data.DataRow parentRow);

Paramètres

parentRow
DataRow

Nouveau DataRow parent.

S’applique à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

SetParentRow(DataRow, DataRelation)

Source:
DataRow.cs
Source:
DataRow.cs
Source:
DataRow.cs

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

C#
public void SetParentRow (System.Data.DataRow? parentRow, System.Data.DataRelation? relation);
C#
public void SetParentRow (System.Data.DataRow parentRow, System.Data.DataRelation relation);

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.

VB
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 à

.NET 9 et autres versions
Produit Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1