JSP large amount of data paging code

Source: Internet
Author: User

Web effects phttp://www.111cn.net/Web effects p.html target=_blank >jsp Tutorials Large amount of data paging code
/*
Paging idea is

First in the database tutorial pagination such as 1000 pages (that is, query 1000 at a time), and then, from the returned 1000 data from the recordset paging

*/

public string Getcountsql (String strwhere) {
  string sqlstr = ' SELECT count (*) from table ';
  if (! "". Equals (strwhere) && strwhere!= null) {
  sqlstr =sqlstr+ "where" +strwhere;
 }
  return sqlstr;
}
///Record Sql:currpage current page rowsperpage how many rows per page www.111cn.net
public string getlistsql (int currpage,string strw Here,int rowsperpage) {
  string sqlstr= "select Top" +rowsperpage+ "Id,name";
  SQLSTR = sqlstr + "from table";
  SQLSTR = sqlstr + "where" (Id not in (select Top + rowsperpage * (currpage-1);
  if ("". Equals (strwhere)) {
  SQLSTR = sqlstr + "ID from Tbdaby ORDER BY id desc)";
 }
  else{
Sqlstr = sqlstr + "id from Tbdaby where" +strwhere+ "ORDER by id DESC") and "+strwhere;
 }  
  SQLSTR = Sqlstr + "ORDER by id DESC";
  return sqlstr;
}


//change to StringBuffer connection string. 111cn.net
//Net

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.