[게시판] 글 조회수

자료 2009. 3. 2. 10:00
...
Connection con = null;
PreparedStatement pstmt = null;
...

try{
...(커넥션 얻기)
StringBuffer addCount = new StringBuffer();
addCount.append("update board set readcount = readcount+1 where num=?");
pstmt = con.prepareStatement(addCount.toString());
pstmt.setInt(1,num);
pstmt.executeUpdate();
...
}
...

이것은 누구나 아는 방법.
보통 글 번호에 따른 게시물을 읽는 코드와 같이 쓴다.(파라미터로 글 번호를 받기 때문에)
Posted by zeide
,