【发布时间】:2014-04-11 00:46:08
【问题描述】:
当我点击 acceptBTN 时,我想更新 stockTBL 中某个项目的数量
private void acceptBTN_Click(object sender, EventArgs e)
{
string constring = @"Data Source=|DataDirectory|\LWADataBase.sdf";
string Query = "UPDATE stockTBL SET Quantity = Quantity+ '" + this.quantityTxt.Text + "' where [Item Name] = '" + this.itemTxt.Text + "';";
SqlCeConnection conDataBase = new SqlCeConnection(constring);
SqlCeCommand cmdDataBase = new SqlCeCommand(Query, conDataBase);
try
{
conDataBase.Open();
MessageBox.Show("Sucess");
//displays a system error message if a problem is found
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
这是我的代码,当我点击 acceptBTN 时,它只显示 MessageBox 而不更新数量。
【问题讨论】:
-
发布后才发现!还是谢谢。