Share via


DataRow.Table Properti

Definisi

Mendapatkan yang DataTable baris ini memiliki skema.

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

Nilai Properti

tempat DataTable baris ini berada.

Contoh

Contoh berikut menggunakan Table properti untuk mengembalikan referensi ke kumpulan DataTablekolom .

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

Keterangan

DataRow tidak harus termasuk dalam kumpulan baris tabel apa pun. Perilaku ini terjadi ketika DataRow telah dibuat tetapi tidak ditambahkan ke DataRowCollection. RowState Jika properti mengembalikan DataRowState.Detached, baris tidak berada dalam koleksi apa pun.

Berlaku untuk

Lihat juga