jsp中SQL的分页语句问题

来源:百度知道 编辑:UC知道 时间:2024/05/21 10:53:51
int PageSize = 6;//每页显示记录数
int StartRow = 0; //开始显示记录的编号
int PageNo=0;//需要显示的页数
int CounterStart=0;//每页页码的初始值
int CounterEnd=0;//显示页码的最大值
int RecordCount=0;//总记录数;
int MaxPage=0;//总页数
int PrevStart=0;//前一页
int NextPage=0;//下一页
int LastRec=0;
int LastStartRecord=0;//最后一页开始显示记录的编号
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:xiaole");
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("select count(*) from NA" );

rs.next();
RecordCount = rs.getInt(1);

rs = statement.executeQuery("不会写的分页语句");
%>
</table>

<br>
<table width="100%" border="0" class="NormalTableTwo">
<tr>
<td class="InternalHeader">id</td>
<td class

以下是oracle分页sql的一个示例,其他的数据库类型我不会,希望对你有用
以下语句能取出user_user从第6条到第10条(包括第十条)的记录
select * from (select rownum as myrownum,u.*from user_user u where rownum<=10) where myrownum>5

分页显示不能用一条SQL语句实现,以下是一段分页显示代码
视你的具体情况修改
public class goodsByPageBean
{ int pageSize=10; //每页显示的记录数
int pageAllCount=0; //分页后的总页数
int showPage=1 ; //当前显示页
StringBuffer presentPageResult; //显示当前页内容
CachedRowSetImpl rowSet; //用于存储ResultSet对象
String databaseName=""; //数据库名称
String tableName=""; //表的名字
String user="" ; //用户
String password="" ; //密码

String 字段[]=new String[100] ;
int 字段个数=0;
public goodsByPageBean()
{ presentPageResult=new StringBuffer();
try{ Class.forName("