GetOrdinal method

Description

Identifies the column ordinal, given the column name.

Syntax

int GetOrdinal( string name )

Parameters

name: The column name.

Return Value

The zero-based column ordinal.

Implements

IDataRecord.GetOrdinal

Usage

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

GetOrdinal is Japanese 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.