Bagikan melalui


DataColumn.Ordinal Properti

Definisi

Mendapatkan posisi (berbasis nol) kolom dalam DataColumnCollection koleksi.

public:
 property int Ordinal { int get(); };
[System.ComponentModel.Browsable(false)]
public int Ordinal { get; }
[System.ComponentModel.Browsable(false)]
[System.Data.DataSysDescription("DataColumnOrdinalDescr")]
public int Ordinal { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Ordinal : int
[<System.ComponentModel.Browsable(false)>]
[<System.Data.DataSysDescription("DataColumnOrdinalDescr")>]
member this.Ordinal : int
Public ReadOnly Property Ordinal As Integer

Nilai Properti

Posisi kolom. Mendapatkan -1 jika kolom bukan anggota koleksi.

Atribut

Contoh

Contoh berikut mengembalikan nama kolom, ordinal, dan jenis data kolom.

private void PrintColumnDetails(DataColumn column)
{
    // Print the Ordinal, ColumnName, and
    // DataType of the column.
    Console.WriteLine(column.Ordinal);
    Console.WriteLine(column.ColumnName);
    Console.WriteLine(column.DataType);
}
Private Sub PrintColumnDetails(ByVal column As DataColumn)
    ' Print the Ordinal, ColumnName, and 
    ' DataType of the column.
    Console.WriteLine(column.Ordinal)
    Console.WriteLine(column.ColumnName)
    Console.WriteLine(column.DataType)
End Sub

Berlaku untuk

Lihat juga