Here is what the Qt5 code looks like at this time.
int rowcount = recipeTable.rowCount();
qDebug () << "recipe select returned " << rowcount << " rows";
if (!recRecipe.isEmpty()) // backwards way to say record exists
{
// if we get this far, it's an update
recRecipe.setValue("isactive",false);
// recipeUpTable.setData(recipeUpTable.index(0,2), false);
bool boolRecSubmit = recipeTable.submitAll(); // and update the existing record
qDebug () << "value for isactive is " << recRecipe.value("isactive");
qDebug () << "updating recipe returned " << boolRecSubmit;
qDebug () << "updating recipe record to not active " <<recipeTable.lastError().text();
int rowcount = recipeTable.rowCount();
qDebug () << "recipe select returned " << rowcount << " rows";
QSqlRecord recRecipe = recipeTable.record(0);
if (!recRecipe.isEmpty()) // backwards way to say record exists
{
// if we get this far, it's an update
recRecipe.setValue("isactive",false);
// recipeUpTable.setData(recipeUpTable.index(0,2), false);
bool boolRecSubmit = recipeTable.submitAll(); // and update the existing record
qDebug () << "value for isactive is " << recRecipe.value("isactive");
qDebug () << "updating recipe returned " << boolRecSubmit;
qDebug () << "updating recipe record to not active " <<recipeTable.lastError().text();
To copy to clipboard, switch view to plain text mode
Application Output ...
recipe select returned 1 rows
value for isactive is QVariant(bool, false)
updating recipe returned true
updating recipe record to not active " "
Somehow the change is not reflected in the database table.
2ActiveRecipes.png
The first row should have isactive false.
Bookmarks