Пример #1
0
  // get a feature_info object by searching feature_info_id
  public Feature_info getFeature_infoByFeature_infoID() throws IOException {
    try {
      String sql = "select * from t_feature_info where ID = ?";
      DBConnect dbc = new DBConnect();
      dbc.prepareStatement(sql);
      dbc.setInt(1, ID);
      ResultSet rs = dbc.executeQuery();

      if (rs.next()) {
        Feature_info feature_info = new Feature_info();
        feature_info.setID(rs.getInt(1));
        feature_info.setNO(rs.getInt(2));
        feature_info.setTitle(rs.getString(3));
        feature_info.setSummary(rs.getString(4));
        dbc.close();
        return feature_info;
      } else dbc.close();

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return null;
  }
Пример #2
0
  // get all feature_info
  public Vector getAllFeature_info() throws Exception {
    String sql = "select * from t_feature_info";

    try {
      DBConnect dbc = new DBConnect();
      ResultSet rs = dbc.executeQuery(sql);
      Vector feature_infoVector = new Vector();
      while (rs.next()) {
        Feature_info feature_info = new Feature_info();
        feature_info.setID(rs.getInt(1));
        feature_info.setNO(rs.getInt(2));
        feature_info.setTitle(rs.getString(3));
        feature_info.setSummary(rs.getString(4));
        feature_infoVector.add(feature_info);
      }
      dbc.close();
      return feature_infoVector;

    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return null;
  }