PDA

View Full Version : QSqlRecord setValue doesn't set the value



sgmurphy19
7th February 2008, 20:21
I have a TableView and I create a QSqlQueryModel and then set the the table. All that works well and good.

From another class, I look at a record of the model based on the index.
If a certain value is null, then I give it a value like so:


// int rowIndex is passed
QString Image_Set_ID = "some value";
QVariant qvImage_Set_ID;
qvImage_Set_ID.setValue(Image_Set_ID);
((QSqlQueryModel*)(tableView->model()))->record(rowIndex).setValue("Image_Set_ID", qvImage_Set_ID);

But then if I look at the record from the model of the tableView again, it isn't updated.

Thanks,
Sean

What is missing?

wysota
7th February 2008, 21:20
QSqlQueryModel is read only, that's one thing. Changing the record doesn't modify the database (record() returns a copy of the record), that's another thing.