(笔记)JDBC 中 Update 代码

public static void updateDep(int department_id,Float salary){
    Connection con=DMmanager.getConnection();
    PreparedStatement pst = null;
    String str = "update department set salary=? where department_id=?"
    pst = con.prepareStatement(str);
   
    pst.getId(1,department_id);
    pst.getFloat(2,salary);
   
    pst.executeUpdate();
    pst.close();
    con.close();
}

你可能感兴趣的:(jdbc)