我有一個表Metal_Master
在那個列中有Opening_Weight
我正在更新該列的值,通過獲取以前的值並添加一些值然後再次更新該值。在SQL表中的行增量值
我對這個代碼是
ConnectionDB ReturnMWeight = new ConnectionDB("SELECT Opening_Weight FROM Metal_Master WHERE Metal_Name='GOLD';");
DataTable weighttd = ReturnMWeight.returntable();
GoldW = GoldW + Convert.ToDouble(weighttd.Rows[0][0].ToString());
ConnectionDB AddMWeight = new ConnectionDB("UPDATE Metal_Master SET Opening_Weight=" + GoldW + " WHERE Metal_Name='GOLD';");
AddMWeight.AddData();
,但我想直接更新單查詢值請幫助..
*跟進的問題:什麼是'ConnectionDB' * –
ConnectionDB是我的數據庫相關的功能 – Milind