Getting field index from field name using sqlDataReader
Posted on 2004-08-04
Im trying to find a quick way of getting the field number from just having the field name using sqlClient.sqlDataReader.
I could do a loop though each field untill I reach the correct field then pass back the index number, but I was wonder if there was an easier way?
[example - my current solution]
Function ReturnFieldIndex(byval Name as String, byval DataReader as sqlClient.sqlDataReader) as Integer
For a = 0 To DataReader.FieldCount - 1
If DataReader.GetName(a) = Name Then