我有一个文本框,用户可以在其中输入日期,例如 2013 年 11 月 29 日。
我想要转换以下字符串:
String sql = "select * from review where creationdate like '?%' order by creationdate desc";
(进入)
String sql = "select * from review where creationdate like '29-NOV-2013%' order by creationdate desc";
使用参数占位符。 我该怎么做?
最佳答案
PreparedStatement pstmt =
con.prepareStatement("select * from review where creationdate like ? order by creationdate desc");
pstmt.setString(1, "29-NOV-2013%")
关于java - 如何将值传递给? java中用单引号括起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20308380/