1
我正在使用以下代码段从选择查询中检索有限数量的原始数据。问题与PreparedStatement与多个paramsin java mysql
String query="SELECT * FROM smsmessage WHERE recipient = ? LIMIT ?";
PreparedStatement prepStmt = conn.prepareStatement(query);
prepStmt.setString(1,shortCode);
prepStmt.setString(2,batchSize);
ResultSet rs=prepStmt.executeQuery();
但它给了我下面的问题
ERROR {com.axiata.plugin.ReceiveSMS.ReceiveSMSNotification} - MySQL exception
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
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 ''2'' at line 1
有没有在我的代码段的任何错误?我不能像上面那样使用多个参数吗?
@ M.Deinum虽然,即使你可以......限制不会是一个字符串。 – Powerlord
那么我怎样才能做到这一点?我想通过两个练习 – Malintha
Doh ...完全错过了。 –