Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QSqlDatabase setDatabaseName qrc
yunjungao last edited by yunjungao
this is my code：
QSqlDatabase sqliteDatabase =QSqlDatabase::addDatabase("QSQLITE");;
sqliteDatabase.setDatabaseName(dateBaseFile); bool bOpenFlag = sqliteDatabase.open();
dateBaseFile is copied from QRC, and the path has been checked to be correct, but the database cannot be opened. The Error information is QSqlError("-1", "Error opening database", "out of memory").Has anyone ever experienced this before?
You can't open a db from a resource - sqlite doesn't know anything about this. You have to copy it to a local file.
Bonnie last edited by
I don't think sqlite can read a qrc file.
yunjungao last edited by
Ok, thanks for your reply