Gustavo

Gustavo

  • NA
  • 1.3k
  • 455k

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

May 22 2010 2:03 PM

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)