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

前端 未结 4 1501
南方客
南方客 2021-01-26 10:32

I am trying to create a new table in a database which has a name of checkout and a check number which ive put in {0}. But when I run the program it comes up with the error shown

4条回答
  •  情书的邮戳
    2021-01-26 10:52

    You're calling string.Format including {0} in various places, indicating that you want a placeholder to be replaced... but you're not providing the placeholder value.

    You want something like:

    tableCreateCommand.CommandText = string.Format("...", checkNumber);
    

    However, I suspect you actually want multiple parameters ({0}, {1}, {2} etc) rather than just one. What SQL are you expecting from the result of string.Format?

提交回复
热议问题