数据库bb 表News中
进行分页的代码
int PageSize = 5;//每页显示记录数
int StartRow = 0; //开始显示记录的编号问题是:
rs = statement.executeQuery("select title,content,src,anthor,pubdate from news order by id desc LIMIT "+StartRow+", "+PageSize);//DESC 代码加上这句分页成功,但编辑和删除确不能实现,若去掉这句话,分页不能实现但编辑和删除能实现这是什么原因

解决方案 »

  1.   

    rs = statement.executeQuery("select title,content,src,anthor,pubdate from news order by id desc LIMIT "+StartRow+", "+PageSize);//DESC你查询的结果里面没有主键,删除和编辑的时候肯定出现问题。根据主键删除和编辑的话根本就找不到对象啊。
    rs = statement.executeQuery("select id,title,content,src,anthor,pubdate from news order by id desc LIMIT "+StartRow+", "+PageSize);//DESC
    加个id应该就行了
      

  2.   

    编辑和删除的代码怎么没有呢?  按大家分析,有可能没有id造成,要把id付给删除和编辑的记录