www.pudn.com > Jsp-Blog.rar > AddReviewDao.java, change:2010-05-25,size:777b


package myblog.dao; 
 
import java.sql.Connection; 
import java.sql.PreparedStatement; 
import java.sql.SQLException; 
 
import myblog.commons.ConnectionPool; 
 
public class AddReviewDao { 
	public Connection conn = null; 
 
	public PreparedStatement pstmt = null; 
 
	public int addReview( String reviewcontent, 
			String reviewname, String logid) { 
		int number = 0; 
		conn = ConnectionPool.getConnection(); 
		String sql = "insert into review(reviewcontent,reviewname,logid) values(?,?,?)"; 
		try { 
			pstmt = conn.prepareStatement(sql); 
			pstmt.setString(1, reviewcontent); 
			pstmt.setString(2, reviewname); 
			pstmt.setString(3, logid); 
			number = pstmt.executeUpdate(); 
		} catch (SQLException e) { 
 
			e.printStackTrace(); 
		} 
		return number; 
	} 
}