我的语句是这样:select distinct 项目 from con
在这种情况下,GETROW无法正常获取我想要的结果,求教~~

解决方案 »

  1.   

    例如我的记录是这样:学号 项目
                      123    ABC
                      1234   ABC
                      14     AC
                      145    AC
    select distinct 项目 from con
    结果显示数据有4条,而且while(rs.next())会发生
    java.sql.SQLException: [Microsoft][ODBC 驱动程序管理器] 无效的游标状态 
    也就是越界了~~
      

  2.   

    select distinct cout(xx) .....
      

  3.   

    我用VB试这个语句很正常,也就是记录数是2,但JSP不知怎么了..JSP有获取记录数的函数么
      

  4.   

    try{ 
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    }
    catch(ClassNotFoundException e){ 
    out.print(e);
    }
    String strDirPath=application.getRealPath(request.getRequestURI());
      strDirPath=strDirPath.substring(0,strDirPath.lastIndexOf('\\'))+"\\";
      String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+strDirPath+"eischool.mdb";
    //out.print(url);Connection conn=DriverManager.getConnection(url);
    Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                           ResultSet.CONCUR_UPDATABLE);ResultSet rs=stmt.executeQuery("select distinct 项目 from conrs.last();
    int rsc=rs.getRow(); 或者用 out.print(rs.getString(1));当正常显示出ABC AC后就发生游标错误
      

  5.   

    select distinct count(xx)...更加不正确
      

  6.   

    试试:if(rs!=null) int row=rs.getrow();
    应该是rs.last();的问题
      

  7.   

    在我印象中select distinct 项目 from con是忽略重的记录后,取出的记录数
    select count(*) from con 是返回所有的记录数