Esempio n. 1
0
 // 매개 변수로 받은 vo객체 내의 코드로 qna테이블에서 검색해서 vo객체에 저장된 정보로 게시글 정보를 수정한다
 public void updateBoard(BoardVO bVo) {
   String sql =
       "update qna set " + "subject=?, content=?, reg_date=sysdate where num=? and mnum=?";
   int result = 0;
   try {
     conn = getConnection();
     pstmt = conn.prepareStatement(sql);
     pstmt.setString(1, bVo.getSubject());
     pstmt.setString(2, bVo.getContent());
     pstmt.setInt(3, bVo.getNum());
     pstmt.setInt(4, bVo.getMnum());
     result = pstmt.executeUpdate();
     System.out.println(result + "개의 행이 수정되었습니다..");
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     CloseUtil.close(pstmt);
     CloseUtil.close(conn);
   }
 }
Esempio n. 2
0
  // 전달인자로 받은 vo객체를 qna테이블에 삽입한다–Ž
  public void insertBoard(BoardVO bVo) {
    String sql =
        "insert into qna("
            + "num, mnum, subject, content, reg_date) "
            + "values(seq_qna.nextval, ?, ?, ?,sysdate)";

    try {
      conn = getConnection();
      pstmt = conn.prepareStatement(sql);
      pstmt.setInt(1, bVo.getMnum());
      pstmt.setString(2, bVo.getSubject());
      pstmt.setString(3, bVo.getContent());
      // pstmt.setString(4, bVo.getAnswer());
      //			pstmt.setDate(4, bVo.getReg_date());
      pstmt.executeQuery();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      CloseUtil.close(pstmt);
      CloseUtil.close(conn);
    }
  }