qDebug()<<mapper->submit(); qDebug()<<model->submitAll(); qDebug()<<model->lastError();
true false QSqlError(2036, "QMYSQL3: Unable to bind value", "Using unsupported buffer type: -1163005939 (parameter: 1)")
query.exec(QString("CREATE TABLE %1 ( " "id INTEGER PRIMARY KEY, " "num INTEGER, " "question TEXT, " "image LONGBLOB, " "ans1 TEXT, " "ans2 TEXT, " "ans3 TEXT, " "ans4 TEXT, " "ans5 TEXT, " "ans6 TEXT, " "ans7 TEXT, " "ans8 TEXT, " "trueimage LONGBLOB, " "falseimage LONGBLOB, " "questionType TEXT) ") .arg(newLessonName));
QStringList items; items << tr("Вопрос с вариантами ответа") << tr("Вопрос с вводом ответа") << tr("Слайд"); questionTypeModel = new QStringListModel(items, this); ui->questionTypeCB->setModel(questionTypeModel); model = new QSqlTableModel(this); model->setTable(lessonName); questionTypeIndex = model->fieldIndex("questionType"); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->select(); ui->listView->setModel(model); ui->listView->setModelColumn(0); mapper = new QDataWidgetMapper(this); mapper->setModel(model); mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); mapper->setItemDelegate(new QSqlRelationalDelegate(this)); mapper->addMapping(ui->questionLE, model->fieldIndex("question")); mapper->addMapping(ui->ans1LE, model->fieldIndex("ans1")); mapper->addMapping(ui->ans2LE, model->fieldIndex("ans2")); mapper->addMapping(ui->ans3LE, model->fieldIndex("ans3")); mapper->addMapping(ui->ans4LE, model->fieldIndex("ans4")); mapper->addMapping(ui->ans5LE, model->fieldIndex("ans5")); mapper->addMapping(ui->ans6LE, model->fieldIndex("ans6")); mapper->addMapping(ui->ans7LE, model->fieldIndex("ans7")); mapper->addMapping(ui->ans8LE, model->fieldIndex("ans8")); mapper->addMapping(ui->questionTypeCB, questionTypeIndex);
model->setEditStrategy(QSqlTableModel::OnManualSubmit); mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
false QSqlError(2036, "QMYSQL3: Unable to bind value", "Using unsupported buffer type: -1163005939 (parameter: 1)")