GetColumnName method

Returns the name of the column identified by the specified column ID.

Syntax
Visual Basic

Public Function GetColumnName( _
   ByVal columnID As Integer _
) As String
C#

public string  GetColumnName(
   int columnID
);
Parameters
  • columnID   ID of the column. The value must be in the range [0,ColumnCount-1].

Return value

The name of the column or a null reference (Nothing in Visual Basic) if the column has no name. If the column is aliased in the SQL query, the alias is returned.

Remarks

Note that in result sets, not all columns have names and not all column names are unique. If you are not using aliases, the name of a non-computed column is prefixed with the name of the table the column is from. For example, MyTable.ID is the name of the only column in the result set for the query "SELECT ID FROM MyTable".

Column IDs and count may change during a schema upgrade. To correctly identify a column, access it by name or refresh the cached IDs and counts after a schema upgrade.

See also