我正在尝试更新我的 MySql 数据库,但它不起作用。我插入和选择工作正常。不确定这是我的查询语法还是什么。
string id = invoicenumb.Text;
string mysqlIns1 = "UPDATE invoices SET Status = '" +
comboBox1.SelectedItem.ToString() + "' WHERE id = '" +
Convert.ToInt16(id) + "'";
try
{
MySqlConnection mysqlCon = new MySqlConnection(mysqlProv);
mysqlCon.Open();
MySqlDataAdapter MyDA = new MySqlDataAdapter();
MyDA.SelectCommand = new MySqlCommand(mysqlIns1, mysqlCon);
MessageBox.Show("Success!");
mysqlCon.Close();
}
catch
{
MessageBox.Show("Error Occured Please Try Again");
}