错误提示:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?,?,?,?,?,?,current_date(),?,current_date(),?)' at line 1
Connection conn = DBUtil.getConnection();
String sql = ""+
" insert into imooc_goddess"+
" (user_name,sex,age,birthday,email,mobile,"+
"create_user,create_date,update_user,update_date,isdel)"+
" values("+
"?,?,?,?,?,?,?,current_date(),?,current_date(),?)";
PreparedStatement ptmt = (PreparedStatement) conn.prepareStatement(sql);
//...
ptmt.execute(sql);`
1. 列表项目
`
终于找到答案了:
代码中有 : ptmt.execute(sql);有问题,应该是无参数的。
因为在 PreparedStatement ptmt = conn.prepareStatement(sql);已经加载了sql语句。