数据库系统应用与开发--实验四(3)

2020-04-16 09:52

在bookbeak中添加:localdate

public void createBook(BeanBook b) throws BaseException{

if(b.getBarcode()==null || \.equals(b.getBarcode()) || throw new BusinessException(\条码必须是1-20个字\); }

if(b.getBookname()==null || \.equals(b.getBookname()) || throw new BusinessException(\图书名称必须是1-50个字\); }

Connection conn=null; try {

conn=DBUtil.getConnection();

b.getBarcode().length()>20){

b.getBookname().length()>50){

String sql=\; java.sql.PreparedStatement pst=conn.prepareStatement(sql); pst.setString(1, b.getBarcode());

java.sql.ResultSet rs=pst.executeQuery();

if(rs.next()) throw new BusinessException(\条码已经被占用\); rs.close(); pst.close(); sql=\

BeanBook(barcode,bookname,pubid,price,state,localdate) values(?,?,?,?,'在库',?)\; pst=conn.prepareStatement(sql);

}

finally{ } }

if(conn!=null)

try { }

conn.close();

// TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { pst.setString(1, b.getBarcode()); pst.setString(2, b.getBookname()); pst.setString(3, b.getPubid()); pst.setDouble(4, b.getPrice()); pst.setTimestamp(5, new pst.execute(); pst.close();

e.printStackTrace(); throw new DbException(e);

java.sql.Timestamp(System.currentTimeMillis()));

} catch (SQLException e) {


数据库系统应用与开发--实验四(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2016年C语言实验报告

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: