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 'limit0,10' at line 1
package bookshop.run;
import java.sql.*;
import java.util.Vector;
import bookshop.util.*;
import bookshop.book.*;
import javax.servlet.http.HttpServletRequest;
public class op_book extends DataBase{
private book abooks=new book();
private javax.servlet.http.HttpServletRequest request;
private boolean sqlflag=true;
private Vector booklist;
private int page=1;
private int pageSize=10;
private int pageCount=0;
private long recordCount=0;
public String sqlStr="";
public Vector getBooklist(){
return booklist;
}
public boolean getSqlflag(){
return sqlflag;
}
。。。。。。。。。。
。。。。。。。。。。。。
。。。。。。。。。。。。。。。。
f(page==1){
sqlStr=sqlStr+" order by a.Id desc limit0,"+pageSize;
// sqlStr=sqlStr+" order by Id desc "+pageSize;
//sqlStr=sqlStr+" order by a.Id desc limit0,10"+pageSize;
}else{
sqlStr=sqlStr+"limit"+(recordCount-pageSize*page)+","+
(recordCount-pageSize*(page-1));
}
}
------解决方案--------------------------------------------------------
limit0,10这里错了 limit和0之间加个空格