コード例 #1
0
  public static int whereCount(String subsql) {
    DBConnect dbc = null;
    int result = EXECUTE_FAIL;
    String sql = "select count(*) from tb_con_province where " + subsql + "";

    try {
      dbc = new DBConnect(sql);
      ResultSet rs = dbc.executeQuery();
      while (rs.next()) {
        return rs.getInt(1);
      }
      return EXECUTE_FAIL;
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      try {
        if (dbc != null) dbc.close();
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return result;
  }
コード例 #2
0
 public static void fill(ResultSet rs, TbConProvince tbconprovince) throws SQLException {
   tbconprovince.setPid(rs.getInt("pid")); // 自增长主键 省列表
   tbconprovince.setPname(rs.getString("pname")); //
 }