QString strQ
= "INSERT INTO item(dict_id, word, prefix, translated, audioPath, example, pronunciation, wordtype, synonyms) VALUES(?,?,?,?,NULL,?,?,?,?)";
qDebug() <<"PREPARE: " << query.prepare(strQ);
query.
bindValue(3,
QVariant(translated
));
if(query.exec(strQ))
{
qDebug() << "Query exec YES";
MyMessageBox mb;
mb.setStyleSheet("background-color:white; color:black;");
mb.setText("A new word is added: " + word);
mb.
setIconPixmap(QPixmap(":111.png"));
mb.setAutoClose(true);
mb.setTimeOut(2);
mb.exec();
}
else
{
qDebug()<<query.lastError().text() << query.boundValues().count();
}
QSqlQuery query;
QString strQ = "INSERT INTO item(dict_id, word, prefix, translated, audioPath, example, pronunciation, wordtype, synonyms) VALUES(?,?,?,?,NULL,?,?,?,?)";
qDebug() <<"PREPARE: " << query.prepare(strQ);
query.bindValue(0, QVariant(_dictID));
query.bindValue(1, QVariant(word));
query.bindValue(2, QVariant(clan));
query.bindValue(3, QVariant(translated));
query.bindValue(4, QVariant(example));
query.bindValue(5, QVariant(pronun));
query.bindValue(6, QVariant(wordType));
query.bindValue(7, QVariant(synonym));
if(query.exec(strQ))
{
qDebug() << "Query exec YES";
MyMessageBox mb;
mb.setStyleSheet("background-color:white; color:black;");
mb.setText("A new word is added: " + word);
mb.setIconPixmap(QPixmap(":111.png"));
mb.setStandardButtons(QMessageBox::Ok);
mb.setAutoClose(true);
mb.setTimeOut(2);
mb.exec();
}
else
{
QMessageBox::warning(this, "Adding of word ", "A new word is not added",QMessageBox::Ok);
qDebug()<<query.lastError().text() << query.boundValues().count();
}
To copy to clipboard, switch view to plain text mode
Bookmarks