Esempio n. 1
0
  public CoreList View_Employee(String emp_id) throws SQLException {
    CoreList ch = new CoreList();
    ch.clear();
    PreparedStatement pst = null;
    ResultSet rs = null;
    DBConn conn = new DBConn();
    System.out.println(emp_id);
    con = conn.getConnection();
    try {

      pst = con.prepareStatement("select * from employee_reg where emp_id='" + emp_id + "'");
      System.out.println("chai");
      rs = pst.executeQuery();
      while (rs.next()) {
        EmployeeRegForm psf = new EmployeeRegForm();
        psf.setPs_id(rs.getInt(1));
        psf.setDept_name(rs.getString(2));
        System.out.println(rs.getString(2));
        psf.setEmp_id(rs.getString(3));
        psf.setEmp_firstname(rs.getString(4));
        psf.setEmp_lastname(rs.getString(5));
        psf.setSex(rs.getString(6));
        psf.setJoin_date(rs.getString(7));
        psf.setDesignation(rs.getString(8));

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

    } finally {
      releaseResources(con, pst);
    }
    return ch;
  }