I\'m trying to get the column names of a table I have stored in SQL Server 2008 R2.
I\'ve literally tried everything but I can\'t seem to find how to do this.
Ri
Currently, there are two ways I could think of doing this:
INFORMATION_SCHEMA.COLUMNS. There, you would need to select the row for your table, matching on the column TABLE_NAME.SqlDataReader instance that is returned by ExecuteReader. The class provides a property FieldCount, for the number of columns, and a method GetName(int), taking the column number as its argument and returning the name of the column.