Multiple choice technology web technology

Which method is used to Get the name of the specified column from SqlDataReader (or any ADO.NET DataReader)?"

  1. GetSqlValue ()

  2. GetOrdinal ()

  3. GetName ()

  4. all the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

GetName(int ordinal) returns the column name for a given zero-based position ordinal in DataReader. GetOrdinal is the inverse (name -> ordinal). GetSqlValue gets value as SqlTypes. GetName() is specifically for getting column names.