DataRow.Table Propriedade
Definição
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
Valor da propriedade
O DataTable ao qual essa linha pertence.The DataTable to which this row belongs.
Exemplos
O exemplo a seguir usa a Table propriedade para retornar uma referência à coleção Columns do DataTable .The following example uses the Table property to return a reference to the columns collection of the 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
Comentários
Um não DataRow pertence necessariamente à coleção de linhas de uma tabela.A DataRow does not necessarily belong to any table's collection of rows. Esse comportamento ocorre quando o DataRow foi criado, mas não adicionado ao DataRowCollection .This behavior occurs when the DataRow has been created but not added to the DataRowCollection. Se a RowState Propriedade retornar DataRowState.Detached , a linha não estará em nenhuma coleção.If the RowState property returns DataRowState.Detached, the row is not in any collection.