日期:2014-05-18  浏览次数:20908 次

C#对access数据库操作,总是提示操作符丢失
一直提示操作符丢失啊。。好几天也不会了。。
private void button3_Click(object sender, EventArgs e)
  {
  DBConnect();//这是连接数据库的
  oledbCon.Open();
  OleDbCommand cmd = new OleDbCommand("UPDATE 生产基地物资出库 SET 物资编号='" + textBox1.Text + "',物资名称='" + textBox3.Text + "',单价=" + textBox4.Text + ",数量=" + textBox5.Text + ",金额=" + textBox6.Text + ",经手人='" + textBox7.Text + "',收货方='" + textBox10.Text + "',出库时间=#" + textBox8.Text + "#,生产基地编号='" + textBox9.Text + "' WHERE 出库单号='" + textBox2.Text + "'", oledbCon);
  cmd.ExecuteNonQuery();
  oledbCon.Close();
  ComonDataView();

  }

------解决方案--------------------
你把sql语句中所有的逗号改成英文的逗号,就可以了,你用的是中文的逗号。