MySQL分页实现(非Hibernate)
2009-12-21 00:00:00 来源:WEB开发网核心提示: 测试类:Main()Java代码publicstaticvoidmain(String[]args){DBUtildb=newDBUtil();Connectionconn=db.getConn();PageControlpage=newPageControl(conn,"ptable
测试类:
Main()
Java代码
public static void main(String[] args) {
DBUtil db = new DBUtil();
Connection conn = db.getConn();
PageControl page = new PageControl(conn, "ptable", 80);
ResultSet rs = page.getPage();
try {
while (rs.next()) {
System.out.println(rs.getInt(1)+"--"+rs.getString(2)+"--"+rs.getString(3));
}
db.end(conn); // 关闭连接
} catch (SQLException e) {
e.printStackTrace();
}
}
更多精彩
赞助商链接