When passing values, looking at C# code directly passing string value, error reported showing matching column not found

1
command += "INSERT INTO " + TableName + "(data_id,data_desc,data_price) VALUES(" + ids[i] + ", " + description[i] + "," + price[i] + ");"+"\r\n";

After the running error, I found that I didn’t consider that the command is passed completely in string form. At this time, the string passed by description does not have double quotes “ “, the string form of the command is:

1
2
"insert into table (data_id,data_desc,data_price)
value(111,description,1.001)"

You can see that description has no double quotes so the command is wrong. You need to modify the command description to add single quotes.

1
", '" + description[i] + "' ,"