Beispiel #1
0
  /**
   * 查询结果
   *
   * @param user
   */
  public void query(String user, boolean sign) {

    if (sign) {
      rs = DB.query(sql);
      try {
        int i = 0;
        while (rs.next()) {
          setYear(rs.getInt("year"), i);
          setRole(rs.getInt("role"), i);
          setRsAll(rs.getInt("rs_all"), i);
          setRsOverStd(rs.getInt("rs_overstd"), i);
          setDegreeAll(rs.getInt("degree_all"), i);
          setDegreeOverStd(rs.getInt("degree_overstd"), i);
          setPublisher(rs.getString("publisher"), i);
          setPublishTime(rs.getString("pub_date"), i);
          i++;
          System.out.println(rs.getInt("year"));
        }

      } catch (SQLException e) {
        e.printStackTrace();
      }
    }
  }
Beispiel #2
0
  /**
   * 初始化
   *
   * @param user
   */
  public boolean init(String user) {

    sql = "select * from info_train where publisher='" + user + "'";
    rs = DB.query(sql);
    try {
      while (rs.next()) {
        trainNumber++;
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }
    if (trainNumber != 0) {
      // 初始化JavaBean数组
      year = new int[trainNumber];
      role = new String[trainNumber];
      rsAll = new int[trainNumber];
      rsOverStd = new int[trainNumber];
      degreeAll = new int[trainNumber];
      degreeOverStd = new int[trainNumber];
      publisher = new String[trainNumber];
      publishTime = new String[trainNumber];
      return true;
    } else return false;
  }