日期:2014-05-18  浏览次数:20647 次

无效的游标状态??哪里错了,谁帮我看看
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "   errorPage= " "   %>
<%@   include   file= "../incoming/connDB.jsp "%>
<html>
<head> </head>
<body>
<%                      
    //数据库连接
    int   curpage=1;//当前页
int   page_record=20;//每页显示的记录数
curpage=Integer.parseInt(request.getParameter( "page "));//获取传递的值,需要显示的页
                        smt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
//Statement   smt_fy=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
                        //smt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  

//ResultSet   rs_fy=smt_fy.executeQuery( "select   count(*)   from   message ");
                          rs=smt.executeQuery( "select   top   "+page_record+ "   *   from   message   where   id   not   in   (select   top   "+(curpage*page_record)+ "   id   from   message   order   by   id   desc)   order   by   id   desc ");
//本查询语句得到的是所要显示的1000页的20条记录,大致思路为——子查询排除
//需要显示的记录前的所有记录,父查询则对余下的记录进行降序排列
rs.last();
while(rs.next())   {
 
%>

<table   width= "75% "   border= "0 "   align= "center "   cellpadding= "0 "   cellspacing= "0 ">
    <tr>  
        <td> <div   align= "center "> 标题: <%=rs.getString( "title ")%> </div> </td>
    </tr>
    <tr>  
        <td> <div   align= "center "> </div> </td>
    </tr>
    <tr>
        <td> <hr   width= "85% "> </td>
    </tr>
</table>
<%}
rs.close();
%>
                       

   

</body>
</html>

------解决方案--------------------
rs.last();//last就没了,怎么next
while(rs.next())