What\'s the difference between reading a value from an SqlDataReader using this syntax:
Dim reader As SqlClient.SqlDataReader
reader(\"value\").ToString()
>
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.
Source: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.getordinal.aspx