QSqlQuery insert_query; insert_query.prepare("INSERT INTO table1 (field1) VALUES (:field1)"); insert_query.bindValue(":field1", "field1"); if (insert_query.exec()) { QString sKey = QVariant(insert_query.lastInsertId()).toString(); }
INSERT INTO table1 (field1) OUTPUT inserted.* VALUES (1)
QSqlQueryModel *model = new QSqlQueryModel;model->setQuery(tr("exec proc1 "), database);QTableView *view = new QTableView;view->setModel(model);view->show();