照着视频拔下来的代码,怎么就提示这里错了呢
StringBuilder sql = new StringBuilder("select ID,COMMAND,DESCRIPTION,CONTENT from message where 1=1");
List<String> paramList = new ArrayList<String>();
if(command!=null && !"".equals(command.trim())){
sql.append("and `COMMAND`=?");
paramList.add(command);
}
if(description!=null && !"".equals(description.trim())){
sql.append("and DESCRIPTION like '%' ? '%'");
paramList.add(description);
}
PreparedStatement statement = conn.prepareStatement(sql.toString());
buffer.append(" and description like '%'||?||'%'");用这个形式。
我自己知道了,少了个空格sql.append(" and COMMAND=?");