
Originally Posted by
Lykurg
Have you tried it without the transaction? Because I think submitAll() also uses transactions and they may interfere. Just a wild guess...
And you call always
model->database().rollback();
model->database().rollback();
To copy to clipboard, switch view to plain text mode
! That is also not the best solution.
I've tried:
void submit()
{
if(model->submitAll())
{
//model->database().transaction();
if(model->database().commit())
{
commitBtn->setEnabled(false);
}
else
this,
tr("Database error"),
model->database().lastError().text());
}
else
this,
tr("Database error"),
model->database().lastError().text());
}
void submit()
{
if(model->submitAll())
{
//model->database().transaction();
if(model->database().commit())
{
commitBtn->setEnabled(false);
}
else
QMessageBox::information(
this,
tr("Database error"),
model->database().lastError().text());
}
else
QMessageBox::information(
this,
tr("Database error"),
model->database().lastError().text());
}
To copy to clipboard, switch view to plain text mode
and the 'commit' returns false, showing the following error:
cannot commit - no transaction is active, unable to commit transaction.
Uncommenting that line works ok, 'commit' returns true, but no database change, nothing happens..

Bookmarks