I'm trying to do SELECT with DB MySql. This is code:
qDebug() << "status" << db.db().isOpen();
query.prepare("SELECT jobId FROM jobs");
and result is:
status true
QSqlQuery::prepare: database not open
How can I fix it?
Try passing the database in the constructor of the QSqlQuery:
QSqlQuery query(db.db());
query.prepare("SELECT jobId FROM jobs");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With