我正在尝试更新db表从文本框中获取数据......我正在做的是 -
public void update_item()
{
string temp = comboBox3.Text;
string[] ar;
ar = temp.Split('(','%',')');
string tx_name = ar[0];
double tx_pr = Convert.ToDouble(ar[1]);
int new_stock=stock+Convert.ToInt32(textBox3.Text);
double total_cost=new_stock*Convert.ToDouble(textBox4.Text);
OleDbConnection c = new OleDbConnection();
c.ConnectionString = Properties.Settings.Default.bowoniConnectionString;
c.Open();
//MessageBox.Show(new_stock.ToString());
string upd = "update item set batch='" + new_stock + "',expr='" + textBox9.Text + "',stock='" + new_stock + "',unit_pric'" + Convert.ToDouble(textBox4.Text) + "',dis='" + Convert.ToDouble(textBox2.Text) + "',tx='" + tx_name + "',percnt='" + tx_pr + "',mrp='" + Convert.ToDouble(textBox5.Text) + "',total_it='" + total_cost + "',sup='" + comboBox5.Text + "' where item_code='" + textBox12.Text + "'";
OleDbCommand cmd = new OleDbCommand(upd, c);
int x = cmd.ExecuteNonQuery();
if(x>0)
{
MessageBox.Show("Data updated");
}
}
但异常在UPDATE查询中显示为错误