SqlCeDataReader.GetOrdinal Method
Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.
Gets the column ordinal, given the name of the column.
[Visual Basic] Public Overridable Function GetOrdinal( _ ByVal name As String _ ) As Integer Implements IDataRecord.GetOrdinal [C#] public virtual int GetOrdinal(string name ); [C++] public: virtual int GetOrdinal(String* name ); [JScript] public function GetOrdinal( name : String) : int;
Parameters
- name
The name of the column.
Return Value
The zero-based column ordinal.
Implements
Exceptions
Exception Type | 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. |
Remarks
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.
Requirements
Platforms: .NET Compact Framework
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code
See Also
SqlCeDataReader Class | SqlCeDataReader Members | System.Data.SqlServerCe Namespace | GetName
Syntax based on .NET Framework version 1.1.
Documentation version 1.1.1.