String sql = "insert into reply values(null,?,?,?,?,?,?)";
return this.getJdbc().executeUpdate(
sql,
new String[] { reply.getTitle(), reply.getContent(),
reply.getPublishtime().toString(),
reply.getModifytime().toString(),
reply.getTopicid() + "", reply.getUid() + "" });
}
------------------------------------------------------------------------------------------------
public int doDelete(String replyid) {
String sql = "delete from reply where replyid=" + replyid;
return this.getJdbc().executeUpdate(sql, null);
}
---------------------------------------------------------------------------------------------------
public List<Board> findAll(){
List<Board> list=new ArrayList<Board>();
//创建sql语句
String sql="select * from board";
//执行查询
ResultSet rs=this.getJdbc().executeQuery(sql, null);
//遍历
try {
while(rs.next()){
Board board=new Board();
board.setBoardid(rs.getInt("boardid"));
board.setBoardname(rs.getString("boardname"));
list.add(board);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
this.closeResource();
}
return list;
}
--------------------------------------------------------------------------------------------------
public int doUpdate(Reply reply) {
String sql = "update reply set title = ?, content = ?, modifytime = ? where replyid = ?";
return this.getJdbc().executeUpdate(sql, new String[] { reply.getTitle(), reply.getContent(),
reply.getModifytime().toString(), reply.getReplyid() + "" });
}