1
Reply

How Do I: Get the column name from a datareader?

Gustavo

Gustavo

14 years ago
11.6k

Hello:
I am trying to get the name of the column in the datareader in a for/loop. I can get the value of the column, but I also need the name. What do I have wrong or how can I get it?
 
 
for (int i = 0; i < ClassDB.DBDataReader.FieldCount - 1; i++)
{
//TheColumnName = ClassDB.DBDataReader....????
TheColumnValue = ClassDB.DBDataReader[i].ToString();
MessageBox.Show("i=" + i + " TheColumnName=" + TheColumnName + " TheColumnValue=" + TheColumnValue);
}

Answers (1)