SqlCommand cmdColumnName = new SqlCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='DailyBudget' ORDER BY ORDINAL_POSITION", conBudget);
// bla bla bla
SqlDataReader dtrColumnName = cmdColumnName.ExecuteReader();
if (dtrColumnName.Read())
for (int i = 0, x = 1; i < count; i++,x++)
categories[i] = dtrColumnName[x].ToString();
dtrColumnName.Close();
The problem said the index was out of bounded.
As i check for the problem, i found out that i only have one value dtrColumnName[0].ToString()
return to me the correct first column name, but i can't get others column. What should i do?
Thanks for advanced.