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