I'm creating a light APP with QT that add entries into my SQLITE base from my website.
But I've this problem :
("QSQLITE")
QSqlError(-1, "", "")
DATABASE OPENED
QSqlQuery::prepare: database not open
QSqlError(-1, "Driver not loaded", "Driver not loaded")
I'm on a Bananapi (Debian 7) with QT installed and upgrade from Debian-APT.
This is my code :
// Load QSLite driver
qDebug() << bdd.drivers(); //Said : ("QSQLITE")
bdd = QSqlDatabase::addDatabase("QSQLITE");
qDebug() << bdd.lastError();
// Open the database
bdd.setDatabaseName("/var/www/config/database.sqlite");
// Connect to the database
if( ! bdd.open())
{
qDebug() << "ERROR " << EXIT_FAILURE_CANT_OPEN_DATABASE << " : Can't open database";
qDebug() << bdd.lastError();
exit(EXIT_FAILURE_CANT_OPEN_DATABASE);
}
else
qDebug() << "DATABASE OPENED";
query.prepare(....); //Said : QSqlQuery::prepare: database not open.
Any idea ?
Aucun commentaire:
Enregistrer un commentaire