QSqlTableModel with SQLITE and MySQL
I have a QSqlTableModel associated with a database (SQLite or QMYSQL). When performing sumbitAll a 'false "response it is generated, but QSqlError :: NativeErrorCode () returns an empty string and QSqlError :: text () returns a space
However, the data is read and the table is displayed.
Someone has happened to him something?
Are you sure that the database is opened correctly ? What request are you dong before submitAll ?
Thanks @SGaist, The database is open and is correctly displayed on a tableview
Try to work with two databases simultaneously, maybe that's the error
QSqlDatabase db = model->database(); if (db.isValid()) qDebug() << "Is valid"; if (db.isOpen()) qDebug() << "Is open";
shows that db is valid but is closed (but I opened to read data)
I'll recheck my code now.
db.lastError();return after trying to open the database?
My fault!, had closed the database previously :-(
That might happen ;)
By the way, no need to modify the title anymore. You can use the topic tool button to mark the thread as solved :)