Skip to content
Advertisement

How to deal: QSqlQuery::exec() returns false

I’m using Qt and sqlite3. The problem is:

QSqlQuery::exec() returns false.

I thought it is caused by QSqlDatabase::open() because it always returns true! I found that actually does not matter what i set using QSqlDatabase::setDatabaseName(), it will return true, because sqlite will create non existing DB.

I used QFile::exist to test if DB exists. But everything is fine and QFile sees the db.

Code:

messagebox

Advertisement

Answer

I just did not add the database to the build directory.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement