Re: QT + Sqlite not working
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
Code:
model->database().rollback();
! That is also not the best solution.
Re: QT + Sqlite not working
Quote:
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
Code:
model->database().rollback();
! That is also not the best solution.
I've tried:
Code:
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());
}
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..
:(:(
Re: QT + Sqlite not working
I solved the problem!
I was doing "model->removeCollumn(0)" to hide id's collumn, and this was crashing the submitAll(), the right way to hide a collumn is to do "view->hideCollumn(0)" :):)
thanks Lykurg's for trying to figure it out with me.