怎样免费注册网站域名,阿里巴巴1688大企业采购平台,免费注册二级域名网站,自己学网站建设锋哥原创的PyQt6图书管理系统视频教程#xff1a;
PyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~_哔哩哔哩_bilibiliPyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~共计24条视频
PyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~_哔哩哔哩_bilibiliPyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~共计24条视频包括PyQt6图书管理系统视频教程 Python桌面开发 Python入门级项目实战 (无废话版) 火爆连载更新中~、第2讲 登录功能UI设计实现、第3讲 数据库操作工具包dbUtil.py封装等UP主更多精彩视频请关注UP账号。https://www.bilibili.com/video/BV18t4y1R7Qp/首先bookDao.py里编写delete方法
def delete(id):图书删除:param id: 编号:return: 返回执行的记录条数con Nonetry:con dbUtil.getCon()cursor con.cursor()cursor.execute(fdelete from t_book where id{id})return cursor.rowcountexcept Exception as e:print(e)con.rollback()return 0finally:dbUtil.closeCon(con)
接着 bookManage.py的Ui_Form类里编写delete方法 def delete(self):删除记录:return:id self.idInput.text()if id.strip() :QMessageBox.information(None, 系统提示, 请选中您需要删除的那行数据)returnreply QMessageBox.question(self, 系统提示, 您确定要删除这条记录吗,QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No,QMessageBox.StandardButton.No)if reply QMessageBox.StandardButton.Yes:if bookDao.delete(id) 0:QMessageBox.information(None, 系统提示, 删除成功)self.initTable()self.resetForm()else:QMessageBox.warning(None, 系统提示, 删除失败)
最后删除按钮绑定点击事件
# 删除按钮绑定事件self.deleteInput.clicked.connect(self.delete)
运行测试