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]+"')"]

share|improve this question

50% accept rate
Please show us table structure - columnname and datatype. – AVD Jan 21 '12 at 9:18
feedback

1 Answer

up vote 1 down vote accepted

If month is an array of string then try,

string month=MyReader1[month[j]];
share|improve this answer
thank you............... – user1162056 Jan 21 '12 at 9:17
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.