81,092
社区成员
发帖
与我相关
我的任务
分享
public int deleteBookById(String name) {
String sql = "delete from book where id= ? ";
// 初始化count 在下面的update中使用
int count = 0;
try {
conn = DBConnection.getConnection();
ps = conn.prepareStatement(sql);
// 将name 设置到 sql 的问号处
ps.setString(1, name);
// 如果更新成功 则返回 1给 count 否则是 0
count = ps.executeUpdate();