-1

I want to use array in sqldatareader object.

Code

for(int j=0;j<12;j++)   //12 use for month
 {
  if(j!=(mon-1))
   {
   ***String mont = MyReader1["('"+month[j]+"')"].ToString();***
   tt += mont;
   }
 }

I got error like

'January' System.IndexOutOfRangeException: 'January'

i use month name in array

and in database month name is colunm name

i have error in MyReader1["('"+month[j]+"')"]

1 Answers1

0

If month is an array of string then try,

string month=MyReader1[month[j]];
KV Prajapati
  • 93,659
  • 19
  • 148
  • 186