关于图书系统的增减
来源:互联网 发布:yum install y 编辑:程序博客网 时间:2024/05/08 19:08
下面实现图书增减的功能实现的源代码,其中用到了String类,和if 条件语句int整型量, String sqlStr = "insert into books values(?,?,?,?,?,?,?,?)";
try (Connection con = DBConnection.getConnection();
PreparedStatement pstmt = con.prepareStatement(sqlStr);) {
pstmt.setString(1, book.isbn);
pstmt.setString(3, book.author);
pstmt.setString(4, book.yizhe);
pstmt.setFloat(7, book.price);
pstmt.setInt(6, book.date);
pstmt.setString(2, book.bookname);
pstmt.setString(5, book.chubanshe);
pstmt.setString(8, book.booktype);
int result = pstmt.executeUpdate();
if (result > 0) {
JOptionPane.showMessageDialog(null, "添加成功");
} else {
JOptionPane.showMessageDialog(null, "添加失败");
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
try (Connection con = DBConnection.getConnection();
PreparedStatement pstmt = con.prepareStatement(sqlStr);) {
pstmt.setString(1, book.isbn);
pstmt.setString(3, book.author);
pstmt.setString(4, book.yizhe);
pstmt.setFloat(7, book.price);
pstmt.setInt(6, book.date);
pstmt.setString(2, book.bookname);
pstmt.setString(5, book.chubanshe);
pstmt.setString(8, book.booktype);
int result = pstmt.executeUpdate();
if (result > 0) {
JOptionPane.showMessageDialog(null, "添加成功");
} else {
JOptionPane.showMessageDialog(null, "添加失败");
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
0 0
- 关于图书系统的增减
- 关于图书管理系统
- 简单的图书管理系统
- 基于struts的图书系统
- 对access图书图书管理系统的理解
- 关于”图书管理系统(Borrowers,ACM/ICPC World Finals 1994, UVa230)"的讨论
- 关于Java小项目——图书管理系统的总结
- Gridview列的增减
- Tomcat内存的增减
- busybox date 的增减
- Tomcat内存的增减
- 数组长度的增减
- 我的图书管理系统-----可行性报告
- 设计图书管理系统的信息要求;
- DEV C++ 做的图书管理系统
- c简单的图书管理系统
- 图书查询系统的工作原理
- 简单的c++图书管理系统
- jsp页面中script代码放置的位置知识整理
- 静态路由的设置
- Emacs Lisp 功能扩展集锦
- 奇偶数入座
- 程序员该学什么--我目前应该学些啥?
- 关于图书系统的增减
- MobileSubstrate 介绍
- VS2012 代码格式化工具:AStyle和CoolFormat
- 老套的开博第一篇-为什么要做这个博客
- ubuntu 12.04添加快捷键打开应用
- 古代十大性爱之神你知道几个
- 导入工程出现叹号或X号可能的解决方法
- Flume 中Sink批量参数设置调优
- 简单的servlet实例