• 增、删、改、查


    public int doAdd(Reply reply) {
    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() + "" });
    }

  • 相关阅读:
    霍夫直线检测进行复杂环境的树干提取
    matlab工具箱之人眼检测+meanshift跟踪算法--人眼跟踪
    deep learning 练习 牛顿法完成逻辑回归
    deep learning 练习 多变量线性回归
    deep learning 练习1 线性回归练习
    关于移动端键盘弹出
    关于Redux
    docker registry的CI规划
    建立自己的私有docker(ssl&login auth)
    逻辑编程
  • 原文地址:https://www.cnblogs.com/huangzhe1515023110/p/9276120.html
Copyright © 2020-2023  润新知