Esempio n. 1
0
  // ɾ��
  @Override
  public boolean deleteCertType(CertType ct) {
    int i = 0;
    PreparedStatement pstmt = null;
    String sql = "delete from tab_certtype where content=?";
    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, ct.getContent());
      i = pstmt.executeUpdate();
      if (i != 0) return true;

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      System.out.println("delete error!");
    }
    return false;
  }
Esempio n. 2
0
  // ����
  @Override
  public boolean addCertType(CertType ct) {
    // TODO Auto-generated method stub
    int i = 0;
    PreparedStatement pstmt = null;
    String sql = "insert into tab_certtype(content) value(?)";
    try {
      pstmt = conn.prepareStatement(sql);
      //	pstmt.setInt(1, ct.getID());
      pstmt.setString(1, ct.getContent());
      i = pstmt.executeUpdate();
      if (i != 0) return true;

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      System.out.println("addCertType error!");
    }
    return false;
  }
Esempio n. 3
0
  @Override
  public boolean ModifyCertType(CertType ct) {
    // TODO Auto-generated method stub
    int i = 0;
    PreparedStatement pstmt = null;
    String sql = "update tab_certtype set content=? where ID=?";
    try {
      pstmt = conn.prepareStatement(sql);
      pstmt.setString(1, ct.getContent());
      pstmt.setInt(2, ct.getID());
      i = pstmt.executeUpdate();
      if (i != 0) return true;

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      System.out.println("modify error!");
    }
    return false;
  }