SqlCeDataReader.GetOrdinal Method
Visual Studio 2010
Gets the column ordinal, given the name of the column.
Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in System.Data.SqlServerCe.dll)
| Exception | Condition |
|---|---|
| IndexOutOfRangeException |
The name specified is not a valid column name. |
| InvalidOperationException |
The operation is not valid. The SqlCeDataReader may be positioned after the last row in the result set. |
GetOrdinal performs a case-sensitive lookup first. If it fails, a second case-insensitive search is made.
Because ordinal-based lookups are more efficient than named lookups, it is inefficient to call GetOrdinal within a loop. Save time by calling GetOrdinal once and assigning the results to an integer variable for use within the loop.