//添加----------------------------------------------------------------------------------------------
string sqlinsert = "INSERT INTO bookshop(编号,书名,价格) VALUES (@编号,@书名,@价格)";
using (MySqlCommand command = new MySqlCommand(sqlinsert, connection))
{
command.Parameters.AddWithValue("@编号", 7 );
command.Parameters.AddWithValue("@书名", "检测管理");
command.Parameters.AddWithValue("@价格", 14.5);
int rowsAffected = command.ExecuteNonQuery();
if (rowsAffected > 0)
{
Console.WriteLine("\n" + "\n" + "数据插入成功!");
}
else
{
Console.WriteLine("数据插入失败!");
}
}