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

后端 未结 8 905
灰色年华
灰色年华 2020-12-01 08:32

Hey I keep getting an error:

Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

8条回答
  •  感动是毒
    2020-12-01 09:18

    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));
    

提交回复
热议问题