コード例 #1
0
  public void update() {
    try {
      con = DBConnect.openConnection();
      Statement stmt = con.createStatement();
      ResultSet rs =
          stmt.executeQuery(
              "UPDATE basic_salary_details SET job_description = '"
                  + bean.getJobDescription()
                  + "',gross_salary = '"
                  + bean.getGrossSalary()
                  + "',da = '"
                  + bean.getDa()
                  + "',allowance = '"
                  + bean.getAllowance()
                  + "',medical = '"
                  + bean.getMedical()
                  + "',servant = '"
                  + bean.getServant()
                  + "',transport = '"
                  + bean.getTransport()
                  + "' WHERE user_id = '"
                  + bean.getUserId()
                  + "'");

      DBConnect.closeConnection(con);

    } catch (SQLException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void insert() {
    try {
      con = DBConnect.openConnection();
      Statement stmt = con.createStatement();
      int rs =
          stmt.executeUpdate(
              "INSERT INTO basic_salary_details(user_id,job_description,gross_salary,da,allowance,medical,servant,transport) VALUES ('"
                  + bean.getUserId()
                  + "','"
                  + bean.getJobDescription()
                  + "','"
                  + bean.getGrossSalary()
                  + "','"
                  + bean.getDa()
                  + "','"
                  + bean.getAllowance()
                  + "','"
                  + bean.getMedical()
                  + "','"
                  + bean.getServant()
                  + "','"
                  + bean.getTransport()
                  + "')");
      DBConnect.closeConnection(con);

    } catch (SQLException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
コード例 #3
0
  public void updateAll() {

    try {
      con = DBConnect.openConnection();
      Statement stmt = con.createStatement();
      ResultSet rs =
          stmt.executeQuery(
              "UPDATE basic_salary_details SET user_id = '"
                  + bean.getUserId()
                  + "',job_description = '"
                  + bean.getJobDescription()
                  + "',gross_salary = '"
                  + bean.getGrossSalary()
                  + "',da = '"
                  + bean.getDa()
                  + "',allowance = '"
                  + bean.getAllowance()
                  + "',medical = '"
                  + bean.getMedical()
                  + "',servant = '"
                  + bean.getServant()
                  + "',transport = '"
                  + bean.getTransport()
                  + "'");

      ArrayList<BasicSalaryDetailVo> basicSalaryDetailVo = new ArrayList<BasicSalaryDetailVo>();

      while (rs.next()) {

        BasicSalaryDetailVo vo =
            new BasicSalaryDetailVo(
                rs.getInt("sl_no"),
                rs.getString("allowance"),
                rs.getString("da"),
                rs.getString("gross_salary"),
                rs.getString("job_description"),
                rs.getString("medical"),
                rs.getString("servant"),
                rs.getString("transport"),
                rs.getString("user_id"));

        basicSalaryDetailVo.add(vo);
      }
      bean.setBasicSalaryDetailVo(basicSalaryDetailVo);

      DBConnect.closeConnection(con);

    } catch (SQLException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }