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 in the title for the “Productlist varchar(50)”
SQLiteCommand tableCreateCommand = myConnection.CreateCommand();
tableCreateCommand.CommandText = string.Format("create table Checkout{0} (ID int, Productlist varchar{0}, Date varchar {0}, Time varchar (50), Total double)");
tableCreateCommand.ExecuteNonQuery();
You haven’t specified any values for the placeholders in String.Format.
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.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.