コード例 #1
0
  public void update(Etudiant etu) {
    try {
      String sql = SQL_UPDATE + " WHERE idEtu = ?";
      PreparedStatement pstmt = getConnection().prepareStatement(sql);

      pstmt.setInt(1, etu.getAttr_int_idUt());
      pstmt.setInt(2, etu.getAttr_int_numEtudiant());
      pstmt.setString(3, etu.getAttr_str_formation());
      pstmt.setInt(4, etu.getAttr_int_idEc());
      pstmt.setInt(5, etu.getAttr_int_idUt());

      pstmt.executeUpdate();

      pstmt.close();
    } catch (SQLException e) {
      System.err.println("SQL error : " + e.getMessage());
    }
  }
コード例 #2
0
  public void insert(Etudiant etu) {
    try {
      PreparedStatement pstmt = getConnection().prepareStatement(SQL_INSERT);

      pstmt.setInt(1, etu.getAttr_int_idUt());
      pstmt.setInt(2, etu.getAttr_int_numEtudiant());
      pstmt.setString(3, etu.getAttr_str_formation());
      pstmt.setInt(4, etu.getAttr_int_idEc());

      pstmt.executeUpdate();

      pstmt.close();
    } catch (SQLException e) {
      System.err.println("SQL error : " + e.getMessage());
    }
  }
コード例 #3
0
 public void delete(Etudiant etu) {
   delete(etu.getAttr_int_idUt());
 }