I have a table which contains a single column "CODE_CAR". I want to populate this table with list of string as below :
_Connection.Open();
var lst_code_cars = new List<string> { "YH_21", "NM_00", "BAR_N178" };
string cmdText = "INSERT INTO Y157.CARS_IDENDITY(CODE_CAR) VALUES ("+lst_code_cars+")";
MySqlCommand cmd = new MySqlCommand(cmdText, _Connection);
foreach (string cars_code in lst_code_cars )
{
cmd.Parameters.AddWithValue("@"+cars_code , cars_code );
cmd.ExecuteNonQuery();
}
_Connection.Close();
When i try this code, i get error : MySqlException : Parameter '@NM_00' must be defined.