public  class DeptDao{
    public int a    dd(Connection conn,Dept dept)  throws Exception{
         String sql="insert into dept values(?,?,?,)";
         PreparedStatement pst=conn.prepareStatement(sql);
         pst.setInt(1,dept.getDeptno());
         pst.setString(2,dept.getDname());
         pst.setString(3,dept.getLoc());
         return pst.executeUpdate();
    }
public int modify(Connection conn,Dept dept) throws Exception{
         String sql ="Update dept set dname=?,loc=?where deptno=?;
         PrepareStstement pst=conn.prepareStatement(sql);
        pst.setString(1,dept.getDname());
        pst.setString(2,dept.getLoc());
        pst.setInt(3,dept.getDeptno());
        int i=pst.executeUpdate();
        return i;

 

相关文章:

  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2022-02-08
  • 2021-08-26
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案