你去把这个类找出来java.sql.ResultSet,
打开看看有没有这人方法不就是了吗??

解决方案 »

  1.   

    createStatement()时要声明参数,使用可滚动的结果集。
      

  2.   


       激活游标:Statement stmt=null;
    stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,CONCUR_UPDATABLE);
      

  3.   

    ikevin(菜无心) 说得有可能,你有可能是这里没有做,所以游标不能向后退,我用Mysql,用了last()之后,我又用first()就没有出什么问题。
    从你的错误提示来看不是你说的那个错误,是你写的那个方法名字错误,方法名字不对。应该是previous(),而不是preview ()
      

  4.   

    可以了,不过用了这段话:
    String Semester =GetSemester(SelYear,SelTerm); //得到学期数
       StrSql="select count(*) from TCourse where semester='"+Semester+"'";
         RS = workM.executeQuery(StrSql); 
    int SubjectNum=RS.getInt(1); //就错在这句话
       RS.close();
    (以上的这句话我在sql server2000中调式过了,是正确的)
    出现以下错误,这到底是怎么回事java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
    com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    com.microsoft.jdbc.base.BaseResultSet.validateCursorPosition(Unknown Source)
    com.microsoft.jdbc.base.BaseResultSet.getInt(Unknown Source)
    org.apache.jsp.admin.admin_005fview_jsp._jspService(admin_005fview_jsp.java:207)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:285)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:232)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      

  5.   

    因为你的做完查询没有指定ResultSet的指针,
    在 RS = workM.executeQuery(StrSql); 加上RS.next();