MySQL查询在使用内部联接进行更新时给出错误

时间:2019-07-05 10:01:53

标签: mysql

我已编写了有关MySql数据库的查询以更新表,但它给出了错误

string q = "UPDATE inventory_detail" +
               " SET inventory_detail.Quantity = (inventory_detail.Quantity + '" + Convert.ToInt32(qty.Text) + "')" +
               " FROM inventory_detail INNER JOIN Inventory" +
               " ON inventory_detail.inventory_id = Inventory.Inventory_id" +
            " where Inventory.name = '" + item.Text + "'AND loc_id = '" + loc_id + "'; ";

cmd.CommandText = q;
cmd.Connection = conn;
if (cmd.ExecuteNonQuery() > 0)
{
    MessageBox.Show("Data Updated");
}

0 个答案:

没有答案