我不知道我到底写错了那里大家帮忙看看!!!!出错显示sql语句错误:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:YouhaveanerrorinyourSQLsyntax;checkthemanualtha...
我不知道我到底写错了那里 大家帮忙看看!!!!
出错显示sql语句错误:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for .....
int pagesize=3;
int pageCount=0;
int pageNow=1;
int rowCount=0;
try{
String sql;
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/tang","root","root");
PreparedStatement pst=(PreparedStatement) conn.prepareStatement("select count (*) from stus ");
ResultSet rs = pst.executeQuery();
if(rs.next()){
rowCount = rs.getInt(1);
}
if(rowCount%pagesize==0){
pageCount=rowCount/pagesize;
}else{
pageCount=rowCount/pagesize+1;
}
PreparedStatement psm = (PreparedStatement) conn.prepareStatement("select pagesize * from stus where stu_id not in(select (pageNow-1)*pagesize stu_id from stus)");
rs=psm.executeQuery();
展开