You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, December 30th 2007, 3:34pm

qsqlrecord and qsqlrelationaltablemodel

hello,
i try to insert a record into a relationaltablemodel:

model->setRelation(4, QSqlRelation("dzial", "id", "nazwa"));
model->select();
--------------------------------
QSqlRecord record;
...
record.append(f1);
record.append(f2);
record.append(f3);

//field with relation
QSqlField f4("dzial",QVariant::Int);
f4.setValue(QVariant(tmp));
record.append(f4);
...
model->insertRecord(-1, record);

the record is correctly inserted, but the value of a field which has a relation with another table is empty.
can anyone help?