我有很多字段,其中包含逗号分隔值。我必须将它们插入我的 MySql 表中
homeToSchool[0] = "Name";
homeToSchool[1] = "Mumbai, 400080, India";
homeToSchool[2] = "Malad, MG";
var cmdText ="INSERT INTO schoolschedule(Name, From, To) VALUES (@Name, @From, @To)";
cmd.Parameters.AddWithValue("@Name", homeToSchool[0]);
cmd.Parameters.AddWithValue("@From", homeToSchool[1]);
cmd.Parameters.AddWithValue("@To", homeToSchool[2]);
connection.Open();
cmd.ExecuteNonQuery();
由于逗号分隔值,我收到错误。