OleDbDataReader::GetOrdinal Method (String^)
.NET Framework (current version)
Gets the column ordinal, given the name of the column.
Assembly: System.Data (in System.Data.dll)
Parameters
- name
-
Type:
System::String^
The name of the column.
Implements
IDataRecord::GetOrdinal(String^)| Exception | Condition |
|---|---|
| IndexOutOfRangeException | The name specified is not a valid column name. |
GetOrdinal performs a case-sensitive lookup first. If it fails, a second case-insensitive search is made. The method throws an IndexOutOfRange exceptionif the zero-based column ordinal is not found.
GetOrdinal is kana-width insensitive.
Because ordinal-based lookups are more efficient than named lookups, it is inefficient to call GetOrdinal within a loop. Save time by calling GetOrdinal one time and assigning the results to an integer variable for use within the loop.
.NET Framework
Available since 1.1
Available since 1.1
OleDbDataReader Class
System.Data.OleDb Namespace
Working with DataReaders
Show: