rsl是什么东东啊,再说了,ResultSet是接收executeQuery()返回回来的值,更新直接用stmt来执行SQL语句

解决方案 »

  1.   

    不好意思,rsl应该时rs,我想把rs作为一个后台的model的,所以才用到updateString。
      

  2.   

    stmt.executeUpdate("update admin.sys_users set USER_NAME='NNNNNN' where user_id=17");
      

  3.   

    可能resultset不能保持数据,大哥们有没有rowset.jar,现在sun不知道发什么神经,不让下了。
      

  4.   

    jdbc3.0才支持update并且需要你的jdbc驱动程序实现了这个功能,update才生效
      

  5.   

    I don't know.Help you up!
      

  6.   

    to update a column value in the current row. In a scrollable ResultSet object, the cursor can be moved backwards and forwards, to an absolute position, or to a position relative to the current row. The following code fragment updates the NAME column in the fifth row of the ResultSet object rs and then uses the method updateRow to update the data source table from which rs was derived.        rs.absolute(5); // moves the cursor to the fifth row of rs
           rs.updateString("NAME", "AINSWORTH"); // updates the 
              // NAME column of row 5 to be AINSWORTH
           rs.updateRow(); // updates the row in the data source
                                      -----摘自jdk文档java.sql.ResultSet
      

  7.   

    前两天在水木上看过类似的问题,“select *”可能不行,用“select 列名”试试
      

  8.   

    yoken(雨泉)说得对,应该在后面使用updateRow()
      

  9.   

    嗯,我知道,但是我的应用不能立刻updateRow,大家有没有Cacherowset,那个应该可以的。
      

  10.   

    用stmt.executeUpdate("update admin.sys_users set USER_NAME='NNNNNN' where user_id=17");这种方法应该可以更新数据库的啊。
    CachedRowset可以从ResultSet得到,但是这样做是为了有时在网络上访问数据库时在得到结果集后可以关闭数据库链接才用的吧,如果用ResultSet的话,关闭数据库链接后里面的记录应该就释放掉了。不知我说的对不对。大家一起讨论。
      

  11.   

    select XXXXX from tablename where condition for update
    最好用PreparedStatement
      

  12.   

    Statement stmt = conn.createStatement(
                                          ResultSet.TYPE_SCROLL_SENSITIVE,
                                          ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt.executeQuery("select 列名1,列名2 from table ");
    rs.absolute(5);
    rs.updateString("列名1", "value");
    rs.updateRow();
    rs.close();
    stmt.close();
    这样是可以的,但是在select语句中不能有group by,order by等等,会导致取不到rowid,就不能更新,限制还挺多的。
      

  13.   

    需要Cacherowset可以mail [email protected]