if(!q.exec()) { QMessageBox::critical(0,"",q.lastError().text()); db.rollback(); return false; }
QVariant MyModel::data(const QModelIndex &index, int role) const {QVariant value = QSqlQueryModel::data(index, role);switch (role) { case Qt::DisplayRole: case Qt::EditRole: if (index.column() == 3 && role == Qt::DisplayRole) return value.toDate().toString("dd.MM.yyyy"); }return value;}
query.prepare("update cities set city_name = 'Абакан' where id_key_city = 1");