引发的异常:在 System.Data 中'System.Data.SqlClient.SqlException'.dll 其他信息:关键字 'Table' 附近的语法不正确



我的代码生成以下错误:

类型" system.data.sqlclient.sqlexception"的未经处理的例外发生在system.data.dll
中 其他信息:
不正确的语法附近')'。

我的代码是:

conn.Open();
SqlDataAdapter sda = new SqlDataAdapter("Update [Table] Set [Name]='" + textBox2.Text + "',[Course]='" + comboBox1.Text + "',[YearSection]='" + textBox3.Text + "' Where [Id]='"+textBox1.Text+"')", conn);
sda.SelectCommand.ExecuteNonQuery();
conn.Close();
MessageBox.Show("Updated Successfully !!!");

有人可以帮助我理解为什么这不起作用。

在查询末尾删除)

相关内容

最新更新