Asp中有rs.addnew的记录集操作方法
jsp中有没有类似的方法呀?

解决方案 »

  1.   

    你是说数据库查询结果的记录集?
    我没用过asp,rs.addnew不知道是什么!
    看字面意思是想直接往结果集中添加新记录不?貌似没有!
      

  2.   

    jinjieai4587 
    说的对
    就是想直接向结果集种添加数据
    用values指定太麻烦了
    用addnew可以不考虑数据类型直接写请问有吗?
      

  3.   

    。。无语。。
    在jdbc2.0中就有
    Statement stmt = con.createStatement(
                                          ResultSet.TYPE_SCROLL_INSENSITIVE,
                                          ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
    rs.moveToInsertRow(); // moves cursor to the insert row
    rs.updateString(1, "AINSWORTH"); // updates the 
    // first column of the insert row to be AINSWORTH
    rs.updateInt(2,35); // updates the second column to be 35
    rs.updateBoolean(3, true); // updates the third column to true
    rs.insertRow();
      

  4.   

    asp的rs.add不是asp的,要搞清楚,那是ado的。
    做jsp看你用什么操作数据库了,楼上的是比较传统的办法,现在流行用hibernate,一个对象的save就可以了。