Breyta

Deila með


DataColumn.Ordinal Property

Definition

Gets the (zero-based) position of the column in the DataColumnCollection collection.

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

Property Value

The position of the column. Gets -1 if the column is not a member of a collection.

Attributes

Examples

The following example returns the column name, ordinal, and data type of a column.

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

Applies to

See also