C# 如何将Inventoryout中的更新输入值减去Inventory? 您需要在查询中加入库存表。请看这里:我还需要@Product吗?如果您想更新特定的产品,可能需要。不过,我对你想做什么还不是很清楚。 //every time i execute the
如何将Inventoryout中的更新输入值减去Inventory?C# 如何将Inventoryout中的更新输入值减去Inventory? 您需要在查询中加入库存表。请看这里:我还需要@Product吗?如果您想更新特定的产品,可能需要。不过,我对你想做什么还不是很清楚。 //every time i execute the,c#,C#,如何将Inventoryout中的更新输入值减去Inventory? 您需要在查询中加入库存表。请看这里:我还需要@Product吗?如果您想更新特定的产品,可能需要。不过,我对你想做什么还不是很清楚。 //every time i execute the NewBind() it subtract all of the same product name in the inventory out and update the inventory. private void NewBind()
您需要在查询中加入库存表。请看这里:我还需要@Product吗?如果您想更新特定的产品,可能需要。不过,我对你想做什么还不是很清楚。
//every time i execute the NewBind() it subtract all of the same product name in the inventory out and update the inventory.
private void NewBind()
{
try
{
MySqlConnection con = new MySqlConnection("connection..");
con.Open();
MySqlCommand cmd = con.CreateCommand();
cmd.CommandText = "update inventoryOut.TotalPrice = (inventory.TotalPrice - inventoryout.TotalPrice) where inventory.Product = @Products";
cmd.Parameters.AddWithValue("@Products", cbProductOut.SelectedItem.ToString());
cmd.Prepare();
cmd.ExecuteNonQuery();
BindGridInventory();
con.Close();
}
catch(Exception t)
{
MessageBox.Show(t.Message);
}
}
//sample
inventory DB(lets assume that this is already deducted product 1 10 stocks)
Product 1 100 stocks 1000 Total Price
Product 2 50 stocks 500 Total Price
inventoryOUT BD(let assume the last value is the updated)
Product 1 10 stocks 100 Total Price
Product 1 50 stocks 500 Total Price
..not desired output
newBind():
inventory DB
Product 1 40 stocks 400 Total Price
Product 2 50 stocks 500 total Price
..desired output
newBind():
inventory DB
Product 1 50 stocks 500 Total Price
Product 2 50 stocks 500 total Price