上述方法的作用是向数据库中的'Gonggao'表中插入一条公告信息。具体实现是通过执行插入SQL语句,将公告的标题、内容和创建时间插入到数据库中。如果在执行插入过程中出现异常,将抛出运行时异常。

public void addGonggao(Gonggao Gonggao) {
    try {
        //执行插入sql
        runner.update("insert into Gonggao(title,content,ctime) values (?,?,?)",
                Gonggao.getTitle(),Gonggao.getContent(),Gonggao.getCtime());
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
     

}

原文地址: http://www.cveoy.top/t/topic/pQ15 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录