Export (0) Print
Expand All

SqlCeDataReader.GetOrdinal Method

Gets the column ordinal, given the name of the column.

Namespace: System.Data.SqlServerCe
Assembly: System.Data.SqlServerCe (in system.data.sqlserverce.dll)

public override int GetOrdinal (
	string name
)
public int GetOrdinal (
	String name
)
public override function GetOrdinal (
	name : String
) : int
Not applicable.

Parameters

name

The name of the column.

Return Value

The zero-based column ordinal.

Exception typeCondition

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.

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows XP Professional x64 Edition, Windows XP SP2

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft