Beispiel #1
0
  public int addNhanVien(NhanVien nv) {
    int result = 0;

    try {
      con = SQLConnection.getConnection();
      pstmt = con.prepareStatement(sqlAddNhanVien);

      pstmt.setString(1, nv.getTen());
      pstmt.setString(2, nv.getTenDangNhap());
      pstmt.setString(3, nv.getMatKhau());
      pstmt.setString(4, nv.getGhiChu());

      result = pstmt.executeUpdate();

    } catch (SQLException e) {
      e.printStackTrace();
    } finally {
      SQLConnection.closeConnection(this.con);
      SQLConnection.closePrepareStatement(pstmt);
    }

    return result;
  }