PreparedStatement stmt = conn.prepareStatement( "SELECT acct_id, balance FROM account", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); // 更新 while( rs.next( ) ) { long acct_id = rs.getLong(1); double balance = rs.getDouble(2); balance = balance + (balance * 0.03)/12; rs.updateDouble(2, balance); rs.updateRow( ); } // 插入 rs.moveToInsertRow( ); rs.updateString(1, "newuid"); rs.updateString(2, "newpass"); rs.insertRow( ); rs.moveToCurrentRow( ); // 删除 deleteRow( )
JDBC 可更新数据集 CONCUR_UPDATABLE
最新推荐文章于 2024-03-08 10:44:46 发布