Esempio n. 1
0
  @Override
  public void update(Utilisateur obj) {
    Connection cx = null;
    PreparedStatement st = null;
    /// ResultSet rs = null;

    try {
      cx = this.connect;
      st =
          cx.prepareStatement(
              "update UTILISATEUR set login = ?, code_activation = ?, password = ?, telephone = ?, nom = ?, prenom = ? where id_utilisateur = ?");
      st.setString(1, obj.getLogin());
      st.setString(2, obj.getCode_activation());
      st.setString(3, obj.getPassword());
      st.setString(4, obj.getTelephone());
      st.setString(5, obj.getNom());
      st.setString(6, obj.getPrenom());
      st.setInt(7, obj.getId_Utilisateur());

      st.executeUpdate();

    } catch (SQLException e) {
      e.printStackTrace();
    }
  }
Esempio n. 2
0
  @Override
  public void create(Utilisateur obj) {

    Connection cx = null;
    PreparedStatement st = null;
    // ResultSet rs = null;

    try {
      cx = this.connect;
      st =
          cx.prepareStatement(
              "insert into UTILISATEUR (login, code_activation, password, telephone, nom, prenom, id_utilisateur) values (?, ?, ?, ?, ?, ?, default)");
      st.setString(1, obj.getLogin());
      st.setString(2, obj.getCode_activation());
      st.setString(3, obj.getPassword());
      st.setString(4, obj.getTelephone());
      st.setString(5, obj.getNom());
      st.setString(6, obj.getPrenom());

      st.executeUpdate();

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