vb.net中的SQL语法错误

时间:2013-06-26 06:47:30

标签: mysql vb.net

我在VB.Net中有此代码,但收到错误you have an error in your sql syntax check the manual that corresponds to your mysql server to use near...

我该如何解决?

cmd.CommandText = "INSERT INTO isu_mod_alertare (nr_rap_ext_aler, mod, 
forte, procedee, cmd_fuct, nume_cmd) VALUES ('" + nrraport.Text + "', '"
+ MODT.Text + "', '" + fortet.Text + "', '" + procst.Text + "', '" 
+ cdtt.Text + "', '" + numecdt.Text + "')"

cmd.ExecuteNonQuery()

1 个答案:

答案 0 :(得分:0)

MOD是mysql中的保留字,所以在你的mod字段中添加引号,如'mod'

请参阅documentation