JDBC中SQL更新查询中的java错误
对于下面给出的命令,如果变量body_模板包含“Abhinav's number”,则显示以下错误:
您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,了解使用near的编号的正确语法
String sql_command = "Update email_template set body_template='"+body_template+"' WHERE id="+idno;
//body_template, idno are of type String
stmt.executeUpdate(sql_command); //Here stmt is a variable of type statement.
请建议我应该如何重新设计我的查询,以便处理此类案件。注意:无法更改输入。问题的出现是因为输入中包含了'
共 (0) 个答案