Using c# how do I print all columns in a datareader.
This method will return an enumerable list of column names when passed a datareader:
static List<string> GetDataReaderColumnNames(IDataReader rdr)
{
var columnNames = new List<string>();
for (int i = 0; i < rdr.FieldCount; i++)
columnNames.Add(rdr.GetName(i));
return columnNames;
}