先上代码
public List allSel(int pageNum, page page) {
List list = new ArrayList();
PreparedStatement ps;
try {
if (pageNum != page.getPageCount())
ps = conn
.prepareStatement("select * from item where ite_title like ? or ite_descr like ? or ite_type like ? limit ?,6");
else {
ps = conn
.prepareStatement("select * from item where ite_title like ? or ite_descr like ? or ite_type like ? limit ?,?");
ps.setInt(5, page.getLastPageNum());
}
上面的这个allSel方法,每次第一次执行的时候都会在第一种sql语句那里报错,然后接着执行又不报错。请解惑。。