Example #1
0
  // ���ң���ȷ���� + ģ�����
  @Override
  public CertType findJQ(String s, Object o) {
    CertType ct = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;

    String sql = "select * from tab_certtype where " + s + "=?";
    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setObject(1, o);
      rs = pstmt.executeQuery();
      if (rs.next()) {
        ct = new CertType();
        ct.setID(rs.getInt("ID"));
        ct.setContent(rs.getString("content"));
      }

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      System.out.println("findJQ error!");
    } finally {
      DBUtils.closeStatement(rs, pstmt);
      //	DBUtils.closeConnection(conn);
    }
    return ct;
  }
Example #2
0
  @Override
  public List<CertType> findMH(String s, Object o) {
    // TODO Auto-generated method stub
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    List<CertType> certTypeList = new ArrayList<CertType>();
    String sql = "select * from tab_certtype where " + s + " like '%" + o + "%'";
    try {
      conn = DBUtils.getconnection();
      pstmt = conn.prepareStatement(sql);
      //	pstmt.setObject(1, "'%" + o + "%'");
      rs = pstmt.executeQuery();
      while (rs.next()) {
        CertType ct = new CertType();
        ct.setID(rs.getInt("ID"));
        ct.setContent(rs.getString("content"));
        certTypeList.add(ct);
      }

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      System.out.println("findMH error!");
    } finally {
      //		    DBUtils.closeConnection(conn);
      DBUtils.closeStatement(rs, pstmt);
    }
    return certTypeList;
  }
Example #3
0
  public List<CertType> getCertType() throws SQLException {
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    List<CertType> certTypeList = new ArrayList<CertType>();

    try {
      pstmt = conn.prepareStatement("select * from tab_certtype");
      rs = pstmt.executeQuery();
      while (rs.next()) {
        CertType ct = new CertType();
        ct.setID(rs.getInt("ID"));
        ct.setContent(rs.getString("content"));
        certTypeList.add(ct);
      }

    } finally {
      //			rs.close();
      //			pstmt.close();

      //		    DBUtils.closeConnection(conn);
      DBUtils.closeStatement(rs, pstmt);
    }
    return certTypeList;
  }