当前位置:网站首页>”QSqlDatabasePrivate::removeDatabase: connection ‘test-connect‘ is still in use“数据库多次打开报错
”QSqlDatabasePrivate::removeDatabase: connection ‘test-connect‘ is still in use“数据库多次打开报错
2022-08-03 00:57:00 【东方忘忧】
数据库多次重复初始化会造成以下问题:
QSqlDatabasePrivate::removeDatabase: connection 'test-connect' is still in use, all queries will cease to work.
QSqlDatabasePrivate::addDatabase: duplicate connection name 'test-connect', old connection removed.
解决方法:
if (!QSqlDatabase::contains("test-connect"))
m_db = QSqlDatabase::addDatabase("QSQLITE","test-connect"); //第一次打开数据库时,连接数据库。
else
m_db = QSqlDatabase::database("test-connect"); //数据库已经打开后,再次连接时,获取句柄。
边栏推荐
- PHICOMM(斐讯)N1盒子 - Armbian5.77(Debian 9)配置自动连接WIFI无线网络
- Flink / Scala - 使用 CountWindow 实现按条数触发窗口
- 为什么要使用 playwright 做浏览器自动化测试?
- 新库上线 | CnOpenDataA股上市公司董监高信息数据
- ASP.NET网络版进销存管理系统源码【源码免费分享】
- 增删改查这么多年,最后栽在MySQL的架构设计上!
- 通力传动递交注册:年营收4.7亿 实控人项献忠家族色彩浓厚
- 和睦家私有化后换帅:新风天域吴启楠任CEO 李碧菁靠边站
- 【图像分类】2022-MPViT CVPR
- 236. The binary tree in recent common ancestor
猜你喜欢
随机推荐
10大领域5大过程47子过程快速记忆
Auto.js special positioning control method cannot perform blocking operations on the ui thread, please use setTimeout instead
9-WebUtil工具类.md
图文详细解决IDEA使用Debug模式启动项目一直转圈圈跑起不来(亲测可以)
13-security其他.md
如何准备考pmp?
Carefully organize 16 MySQL usage specifications to reduce problems by 80% and recommend sharing with the team
js显示隐藏手机号
Day017 封装
VS Code 这么牛,再次印证了一句名言
向往的生活
浅谈敏捷开发
1686. 石子游戏 VI
ssh(sshd)安全配置
作业8.2 线程同步互斥机制——互斥锁
线性DP
微信小程序--》条件与列表渲染以及WXSS模板样式
WRF-Chem模式调试、运行、结果后处理等遇到的各种问题
Violent recursion to dynamic programming 06 (the sword refers to Offer II 095. Longest common subsequence)
php一维数组合并









