QSqlQuery query;query.exec("INSERT INTO kod (kodsv,kodg,kodk)" "VALUES (23213,150200,1)");
QString kodsv,kodg,KODK;kodsv = ui->comboBox_3->currentText();kodg = ui->comboBox_5->currentText();KODK = ui->comboBox->currentText();QSqlQuery query;query.exec("INSERT INTO kod (kodsv,kodg,kodk)" "VALUES (kodsv,kodg,1)");
bool QSqlQuery::prepare ( const QString & query )
QString kodsv,kodg,KODK;kodsv = ui->comboBox_3->currentText();kodg = ui->comboBox_5->currentText();KODK = ui->comboBox->currentText();QSqlQuery query;QString S = QString("INSERT INTO kod (kodsv,kodg,kodk) VALUES (%1,%2,%3)").arg(kodsv,kodg,KODK );query.exec(S);
QString kodsv,kodg,KODK;kodsv = ui->comboBox_3->currentText();kodg = ui->comboBox_5->currentText();KODK = ui->comboBox->currentText();QSqlQuery query;QString S = QString("INSERT INTO kod (kodsv,kodg,kodk) VALUES (:kodsv,:kodg,:kodk)");query.prepare(S);query.bindValue(":kodsv",QVariant(kodsv),QSql::In);query.bindValue(":kodg",QVariant(kodg),QSql::In);query.bindValue(":kodk",QVariant(KODK),QSql::In);query.exec();