0
private void button3_Click(object sender, EventArgs e)
{
if (textBox2.Text != "" & listBox1.SelectedIndex != -1)
{
string q = "update info set name='" + textBox2.Text.ToString() + "' where id " + listBox1.SelectedItem.ToString();
dosomething(q);
textBox2.Text = "";
}
}
private void dosomething(String q)
{
try {
cn.Open();
cmd.CommandText = q;
cmd.ExecuteNonQuery();
cn.Close();
loaddata();
}
每當我試圖用我的程序來更新從MS Access數據我得到這個錯誤: 無法查詢MS Access數據庫:「語法錯誤(缺少操作員)在查詢表達式」
有我的代碼有問題嗎?
**警告**您正在介紹sql注入攻擊! –