Index (zero based) must be greater than or equal to zero

The Solution to Index (zero based) must be greater than or equal to zero is


Your second String.Format uses {2} as a placeholder but you're only passing in one argument, so you should use {0} instead.

Change this:

String.Format("{2}", reader.GetString(0));

To this:

String.Format("{0}", reader.GetString(2));

~ Answered on 2011-03-15 18:41:29


Most Viewed Questions: