方法:
public List doQuery(String dname) throws DataAccessException {
StringBuffer sb = new StringBuffer();
sb.append("select * from AppDepartment where DepName like ? order by ID");
return this.getJdbcTemplate().query(sb.toString(),
new DeptartmentRowMapper(){dname});
我想把dname赋值给?占位符 这样写不对,应该如何写
谢谢
public List doQuery(String dname) throws DataAccessException {
StringBuffer sb = new StringBuffer();
sb.append("select * from AppDepartment where DepName like ? order by ID");
return this.getJdbcTemplate().query(sb.toString(),
new DeptartmentRowMapper(){dname});
我想把dname赋值给?占位符 这样写不对,应该如何写
谢谢
public List doQuery(String dname) throws DataAccessException {
StringBuffer sb = new StringBuffer();
sb.append("select * from AppDepartment where DepName like %s order by ID");
return this.getJdbcTemplate().query(sb.toString().format("%s",dname),
new DeptartmentRowMapper(){dname});