Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QSqlRecord newRecord = model->record();
- newRecord.setValue("owner", QVariant("John Grisham"));
- newRecord.setValue("parcelleFile", QVariant("The Litigators"));
- newRecord.setValue("type", QVariant("test"));
- newRecord.setValue("speed",QVariant(10));
- // qDebug() << "Insert row" << model->insertRecord(model->rowCount(), newRecord);
- /*-1 is set to indicate that it will be added to the last row*/
- if(model->insertRecord(-1, newRecord))
- qDebug()<<"successful insertion" << newRecord.value("owner") << "was its owner";
- model->submitAll();
- QSqlRecord writtenRec( model->record(model->rowCount() - 1 ) );
- qDebug() << "owner of inserted record: " << writtenRec.value("owner") << "row field name 0" << writtenRec.fieldName(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement