[code="java"]String sql = "insert into blog (title,content,category_id,createdtime) values (?,?,?,now() )";[/code]
请问上面的语句有问题吗?
[b]问题补充:[/b]
[code="java"]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 '?,?,?)' at line 1[/code]
就算我把now()去掉 也会出这个错
当然会出错,你少了一个? (title,content,category_id,createdtime)
因为你要存入4个字段 所以出现 at line 1
now() 是方法? 如果是方法就有问题了。。
或者你全部插入;就可以这样写:
String sql = "insert into blog values (?,?,?,?)";