DataRow.Table Propriedade
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém-se o DataTable para o qual esta linha tem um esquema.
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 de Propriedade
A DataTable que esta fila pertence.
Exemplos
O exemplo seguinte usa a Table propriedade para devolver uma referência à coleção de colunas do 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
Observações
A DataRow não pertence necessariamente à coleção de linhas de nenhuma tabela. Este comportamento ocorre quando o DataRow foi criado mas não adicionado ao DataRowCollection. Se a RowState propriedade devolver DataRowState.Detached, a linha não está em nenhuma coleção.