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
You haven't specified any values for the placeholders in String.Format.
string.Format("create table Checkout{0} (ID int, Productlist varchar{0},
Date varchar {0}, Time varchar (50), Total double)", )
It should be something like this. Note the values specified from second parameter onwards. You can use a constant or some variable in place of constants shown here. The value specified after the comma will replace the placeholders in the index order. {0}
will use value 123456, {1}
would use 50, {2}
would use 65 and {3}
would use 75.
string.Format("create table Checkout{0} (ID int, Productlist varchar({1}),
Date varchar({2}), Time varchar ({3}), Total double)", 123456, 50, 65, 75)
If you need to use the same placeholder for varchar as specified for checkout, it should be like this. I am not sure if this is your intention. Here all place holders {0} will use the same value 100.
string.Format("create table Checkout{0} (ID int, Productlist varchar({0}),
Date varchar({0}), Time varchar (50), Total double)", 100)