示例#1
0
 public static String findUniterName(int id) {
   for (Uniter unt : UniterList) {
     if (unt.getIduniter() == id) {
       return unt.getNomUniter();
     }
   }
   return null;
 }
示例#2
0
  // *************************************************************************
  public void uniter() {
    String sql = "SELECT * FROM uniter";
    try (Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql); ) {
      // System.out.println("uniter Table:");
      while (rs.next()) {
        Uniter uniter = new Uniter();
        uniter.setIduniter(rs.getInt("iduniter"));
        uniter.setNomUniter(rs.getString("nomuniter"));

        UniterList.add(uniter);
      }
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }