aspxtreme

OleDbDataReader.GetOrdinal Method

System.Data.OleDb Namespace   OleDbDataReader Class


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

[ VB ]
NotOverridable Public Function GetOrdinal ( _
   ByVal name As String _
) As Integer

[ C# ]
public int GetOrdinal (
   string name
);

[ C++ ]
public: __sealed 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.

Exceptions


Exception Type Condition
IndexOutOfRangeException Occurs when the specified cast is not valid.

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.

See Also

OleDbDataReader Members



Books and more ...


Suggested Reading

Need a break ?



Previous page Back to top Next page

Check out related books at Amazon

© 2000-2008 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support aspxtreme