我遇到了问题
{
double a = Convert.ToDouble(textBox1.Text);
double b = Convert.ToDouble(textBox8.Text);
textBox8.Text = (a + b).ToString();
textBox1.Text = "";
double c = Convert.ToDouble(textBox2.Text);
double d = Convert.ToDouble(textBox9.Text);
textBox9.Text = (c + d).ToString();
textBox2.Text = "";
}
//cmd = new OleDbCommand("update Table1 set balance='" + textBox8 + "','" + textBox9.Text + "','" + textBox10.Text + "','" + textBox11.Text + "','" + textBox12.Text + "','" + textBox13.Text + "','" + textBox14.Text + "', where ID=" + textBox15.Text, con);
cmd = new OleDbCommand("UPDATE Table1 SET OUT = ? " + " WHERE ID = ?", con);
cmd.Parameters.AddWithValue("OUT", textBox8.Text);
cmd.Parameters.AddWithValue("OUT", textBox9.Text);
cmd.Parameters.AddWithValue("ID", textBox15.Text);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
loaddata();
}
我有 2 个textbox
,一个是 Balance,一个是 IN
余额是从我的数据库中加载数据,允许用户输入一个值,所以
IN + Balance = Balance
,这将更新到数据库。
更新功能是完美的。但是我怎样才能先添加值然后运行更新?建议。