I do something like what is shown below, but if you have an updatable view (using multiple tables) on your database then something similar to this snippet should work.
Qt Code:
  1. void homestead::UpdateProperty() {
  2. QDateTime dtNow = QDateTime::currentDateTime();
  3. QString propQryPrep = "UPDATE property_";
  4. propQryPrep.append(this->dbYear);
  5. propQryPrep.append(" SET \
  6. county = :county, \
  7. cntyname = :cntyname, \
  8. txdistrict = :txdistrict, \
  9. legal = :legal, \
  10. parcel_id = :parcel_id, \
  11. pvalue = :pvalue, \
  12. entry_id = :entry_id, \
  13. entry_date = :entry_date, \
  14. notes = :notes \
  15. WHERE proprty_id = :proprty_id");
  16.  
  17. propQry.prepare(propQryPrep);
  18. propQry.bindValue(":county",ui.leCountyNumber->text().toInt());
  19. propQry.bindValue(":cntyname",ui.cboCountyName->currentText());
  20. propQry.bindValue(":txdistrict",ui.leTaxDistrict->text());
  21. propQry.bindValue(":legal",ui.txtLegal->toPlainText());
  22. propQry.bindValue(":parcel_id",ui.leParcelID->text());
  23. propQry.bindValue(":pvalue",ui.leHomeValue->text().toInt());
  24. propQry.bindValue(":entry_id",homestead::RevID);
  25. propQry.bindValue(":entry_date",dtNow);
  26. propQry.bindValue(":notes",ui.teNotes->toPlainText());
  27. propQry.bindValue(":proprty_id",ui.leProprtyID->text().toInt());
  28. if (propQry.exec()) {
  29. ui.leStatus->setText("Property record: "+ui.leProprtyID->text()+" updated!");
  30. } else {
  31. ui.leStatus->setText("Cannot updated property record: "+ui.leProprtyID->text());
  32. }
  33. }
To copy to clipboard, switch view to plain text mode 
BTW, this code works on Oracle and on PostgreSQL before 8.1.0. On PostgreSQL after 8.0 they've added 3 millisecond positions to the QDateTime return.