ResultSet.TYPE_SCROLL_INSENSITIVE-->ResultSet.TYPE_SCROLL_SENSITIVE

解决方案 »

  1.   

    你代码没有问题,应该是你链接数据库方法问题
    想必你是使用jdbc_odbc桥访问的数据库吧?
    通过数据源访问,所生成的结果集是不支持滚动光标且只读的
    所以,即使你代码 
    Statement stmt = con.createStatement(
                ResultSet.TYPE_SCROLL_INSENSITIVE,
                ResultSet.CONCUR_UPDATABLE);
    依然没有用
    使用jdbc链接数据库吧
      

  2.   

    不知道我的程序是否有问题,我是使用jdbc_odbc桥访问的数据库,但是游标可以移动,并且进行了修改操作。
    String sqlGetRootResInfo = "Select FatherID,ResourceName,[Sequence] From CompResourceInfo Where FatherID = 0 order by [Sequence] asc";
    RSGetRootResInfo = HgConn.executeQuery(sqlGetRootResInfo);
    //RSGetRootResInfo.getFetchsize;
    //out.println("1");
    while (RSGetRootResInfo.next()){

    //out.println("1");
    //if (RSGetRootResInfo.getInt("FatherID") == 0 ){
    out.println(RSGetRootResInfo.getString("FatherID"));
    out.println(RSGetRootResInfo.getString("ResourceName")+"<br>");
    // }
    // else{
    // get=RSGetRootResInfo.getString("FatherID");
    // }

    }
    RSGetRootResInfo.beforeFirst();

    while (RSGetRootResInfo.next()){

    //out.println("1");
    //if (RSGetRootResInfo.getInt("FatherID") == 0 ){
    out.println(RSGetRootResInfo.getString("FatherID"));
    out.println(RSGetRootResInfo.getString("ResourceName")+"<br>");
    // }
    // else{
    // get=RSGetRootResInfo.getString("FatherID");
    // }

    }