コード例 #1
0
  @Override
  public void load() {
    String request = "SELECT " + index + ", " + name + " FROM " + table + ";";

    ResultSet result = MySQLDatabase.getInstance().selectRequest(request);

    try {
      // Ouverture de session
      result.beforeFirst();
      ActivityCategory catAct;
      while (result.next()) {
        catAct = new MSActivityCategory();
        catAct.setID(result.getString(index));
        catAct.setName(result.getString(name));
        super.add(catAct);
      }
      /* On ferme le ResultSet */
      result.close();
    } catch (SQLException e) {
      System.err.println(e.getMessage());
    } catch (NullPointerException e) {
      System.err.println(e.getMessage());
    }
  }