DataColumn.Ordinal Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Samarbeta med oss på GitHub
Källan för det här innehållet finns på GitHub, där du även kan skapa och granska ärenden och pull-begäranden. Se vår deltagarguide för mer information.