DataRow.Table Propriedade
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Obtém o DataTable para o qual essa 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
O DataTable ao qual essa linha pertence.
O exemplo a seguir usa a Table propriedade para retornar uma referência à coleção columns 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
Um DataRow não pertence necessariamente à coleção de linhas de nenhuma tabela. Esse comportamento ocorre quando o DataRow foi criado, mas não adicionado ao DataRowCollection. Se a RowState propriedade retornar DataRowState.Detached
, a linha não estará em nenhuma coleção.
Produto | Versões |
---|---|
.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 |
Comentários do .NET
O .NET é um projeto código aberto. Selecione um link para fornecer comentários: