Thanks ChrisW67.
Can i have another question please?
as you see in my code:
query.exec("PRAGMA synchronous = OFF");
model->setTable("c1");
model->select();
model->insertRow(0);
model->setData(model->index(0, 1), String(qdatetime.toString(Qt::ISODate)));
model->setData(model->index(0, 2), String(qdatetime.toString(Qt::ISODate)));
model->setData(model->index(0, 3), 1); // original value is 1 in int
model->submitAll();
QSqlQuery query;
query.exec("PRAGMA synchronous = OFF");
model = new QSqlTableModel(this);
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
model->setTable("c1");
model->select();
model->insertRow(0);
model->setData(model->index(0, 1), String(qdatetime.toString(Qt::ISODate)));
model->setData(model->index(0, 2), String(qdatetime.toString(Qt::ISODate)));
model->setData(model->index(0, 3), 1); // original value is 1 in int
model->submitAll();
To copy to clipboard, switch view to plain text mode
when i click 'stop' button, i want to change the value in last row. here is my code:
model->setTable("c1");
model->select();
int row = model->rowCount();
model->setData(model->index(row, 3), 55); // change the value to be 55 in int
model->sumitAll();
model->setTable("c1");
model->select();
int row = model->rowCount();
model->setData(model->index(row, 3), 55); // change the value to be 55 in int
model->sumitAll();
To copy to clipboard, switch view to plain text mode
however, after i stop my program and take a look database, the last value in (row, 3) has not been changed.
can you point out where i did wrong please?
I really appreciate your help.
Bookmarks