다음을 통해 공유


IDataReader.GetOrdinal(String) Method

Definition

Return the index of the named field.

public:
 int GetOrdinal(System::String ^ fieldName);
public int GetOrdinal (string fieldName);
abstract member GetOrdinal : string -> int
Public Function GetOrdinal (fieldName As String) As Integer

Parameters

fieldName
String

The name of the field to find.

Returns

The index of the named field.

Remarks

GetOrdinal performs a case-sensitive lookup first. If it fails, a second case-insensitive search is made.

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 once and assigning the results to an integer variable for use within the loop.

Applies to