Esempio n. 1
0
  public CoreList count(String dept_name) throws SQLException {
    CoreList ch = new CoreList();
    ch.clear();
    PreparedStatement pst = null;
    ResultSet rs = null;
    DBConn conn = new DBConn();

    con = conn.getConnection();
    try {

      pst =
          con.prepareStatement(
              "select count(*) from employee_reg where dept_name='" + dept_name + "'");
      System.out.println("chai");
      rs = pst.executeQuery();
      while (rs.next()) {
        EmployeeRegForm psf = new EmployeeRegForm();
        psf.setCount(rs.getInt(1));

        ch.add(psf);
      }
    } catch (Exception e) {
      con.close();
      System.out.println("Connection Closed");
      e.printStackTrace();
    }
    return ch;
  }