Hello,
Strange problem occuring. I have a simple QTableView displaying an sqlite table. I can change the data in the table and the changes are sent to the database, but as soon as I exit out of the application and I look at the database table again, the data that was added/changed is not there , but while the app was running I could see the data with a separate db viewing utility.
model->setTable(tableName);
model
->setRelation
(18,
QSqlRelation("Category",
"mCategoryID",
"mCategoryName"));
model->select();
m_pMusicTableView->setModel(model);
m_pMusicTableView->hideColumn(0);
m_pMusicTableView->show();
...
void DlgLibraryEditor::submit()
{
model->database().transaction();
if (model->submitAll()) {
model->database().commit();
} else {
model->database().rollback();
tr("The database reported an error: %1")
.arg(model->lastError().text()));
}
}
model = new QSqlRelationalTableModel();
model->setTable(tableName);
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
model->setRelation(18, QSqlRelation("Category", "mCategoryID", "mCategoryName"));
model->select();
m_pMusicTableView->setModel(model);
m_pMusicTableView->hideColumn(0);
m_pMusicTableView->show();
...
void DlgLibraryEditor::submit()
{
model->database().transaction();
if (model->submitAll()) {
model->database().commit();
} else {
model->database().rollback();
QMessageBox::warning(this, tr("Library Manager"),
tr("The database reported an error: %1")
.arg(model->lastError().text()));
}
}
To copy to clipboard, switch view to plain text mode
any insight greatly appreciated.
Thanks,
Johnny
Bookmarks