QSqlQuery *model = new QSqlQuery(dmModule::db); model->prepare("select result from sprmetrics_modify(:smid,:smname,:smname_short,:smcoef,'','new')"); model->bindValue(":smid",item.smid); ... ... model->setForwardOnly(true); model->exec(); if(model->lastError().isValid()){ QMessageBox::about(0,"errror",model->lastError().text()+model->lastQuery()); } while(model->next()) item.smid = model->record().value("result").toInt(); delete model; return i;