-2
以下更新查詢有問題。sql更新整數類型
string sql = "update Car set plate = '" + textBox2.Text + "' , color='"
+ textBox3.Text + "' , model='"+textBox5.Text+ "' , year= "
+ textBox4.Text;
sql += " where carid= " + textBox1.Text;
int res = CarDatabase.executeOthers(sql);
if (res > 0)
{
string sql2 = "select * from Car";
DataTable dt = CarDatabase.executeSelect(sql2);
mainframe.DataGridView1.DataSource = dt;
MessageBox.Show("Updated Successfully");
}
實際上,當我將年份添加到我的查詢時,我遇到了同樣的問題。爲什麼? :S
SQL注入攻擊去! http://en.wikipedia.org/wiki/SQL_injection – 2011-12-23 22:19:34
什麼是錯誤或效果/輸出?預期的效果是什麼? – Yuck 2011-12-23 22:20:38
知道問題實際是什麼會有幫助。即拋出什麼錯誤,是否有更新的行太少,行數太多? – 2011-12-23 22:21:14