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


package myblog.dao; 
 
import java.sql.Connection; 
import java.sql.PreparedStatement; 
import java.sql.SQLException; 
 
import myblog.commons.ConnectionPool; 
 
public class DelLogDao { 
 
	private Connection conn = null; 
 
	private PreparedStatement pstmt = null; 
 
	public int deleteLog(String logid) throws SQLException { 
		int number = 0; 
		conn = ConnectionPool.getConnection(); 
 
		String sql = "delete from log where logid=?"; 
		try { 
			pstmt = conn.prepareStatement(sql); 
			pstmt.setString(1, logid); 
			number = pstmt.executeUpdate(); 
		} catch (SQLException e) { 
			e.printStackTrace(); 
		} finally { 
			if (conn != null) { 
				conn.close(); 
			} else if (pstmt != null) { 
				pstmt.close(); 
			} 
		} 
		return number; 
	} 
 
}