Partager via


DataRow.Table Propriété

Définition

Obtient la DataTable valeur pour laquelle cette ligne a un schéma.

public:
 property System::Data::DataTable ^ Table { System::Data::DataTable ^ get(); };
public System.Data.DataTable Table { get; }
member this.Table : System.Data.DataTable
Public ReadOnly Property Table As DataTable

Valeur de propriété

DataTable Auquel appartient cette ligne.

Exemples

L’exemple suivant utilise la Table propriété pour renvoyer une référence à la collection colonnes du DataTable.

private void GetTable(DataRow row)
{
    // Get the DataTable of a DataRow
    DataTable table = row.Table;

    // Print the DataType of each column in the table.
    foreach(DataColumn column in table.Columns)
    {
        Console.WriteLine(column.DataType);
    }
}
Private Sub GetTable(ByVal row As DataRow)
   ' Get the DataTable of a DataRow
   Dim table As DataTable = row.Table

   ' Print the DataType of each column in the table.
   Dim column As DataColumn
   For Each column in table.Columns
      Console.WriteLine(column.DataType)
   Next
End Sub

Remarques

A DataRow n’appartient pas nécessairement à la collection de lignes d’une table. Ce comportement se produit lorsque le DataRow fichier a été créé mais n’a pas été ajouté au DataRowCollection. Si la RowState propriété retourne DataRowState.Detached, la ligne n’est pas dans une collection.

S’applique à

Voir aussi