model = new QSqlRelationalTableModel(this); model->setTable("in_stock"); model->setSort(1,Qt::AscendingOrder); model->select(); qDebug()<< model->lastError().text(); while(model->canFetchMore()) model->fetchMore(); ui->tovarBox->setModel(model);
QSqlQuery *sq = new QSqlQuery(); sq->exec("SELECT name FROM in_stock WHERE kod = " + QString::number(kod));
QSqlQuery *sq = new QSqlQuery(); sq->exec("SELECT name FROM in_stock"); sq->next(); qDebug() << sq->value(0).toString();