Hello,
yes i though there could be query problem - but how can examine the query 
generated? I'm using postgresql.

I have this model (simplified)

CREATE TABLE Employee (
  id      serial NOT NULL,
  name    varchar(255) NOT NULL,
  surname varchar(255) NOT NULL,
  PRIMARY KEY (id));

CREATE TABLE EduPlan (
  Employeeid int4 NOT NULL,
  "date"     date NOT NULL,
 );

I have the realtional model like this:

model.setTable("eduplan");
model.setRelation(0, new QSqlRelation("employee", "id", "surname"));
model.setEditStrategy(QSqlTableModel.EditStrategy.OnFieldChange);
ui.planTable.setItemDelegate(new QSqlRelationalDelegate());
model.select();

really simple - almost as the example

thanks

Dne St 19. května 2010 17:05:00 José Arcángel Salazar Delgado napsal(a):
> > Hello,
> > i'm trying to use relationalTableModel as described in doc and examples.
> > Everything is pretty simple almost the same as in example. The model has
> > OnFieldChange EditStrategy However i'm not able to change the relation
> > column value nor delete the row.
> > 
> > While updating the model.lastError() gives:
> > QSqlError(0, "Unable to bind parameters", "The column index is out of
> > range: 4, number of columns: 3. (22023)")
> > 
> > which is strange because the table has 4 columns (including foreign key
> > column)
> > 
> > while deleting (using model.removeRows()) it gives:
> > QSqlError(0, "Unable to execute query", "ERROR: column "surname" does not
> > exist (42703)")
> > 
> > the "surname" is displayColumn of QSqlRelation :(
> > 
> This normaly happend when your query is wrong. What Database are you using?
> This happend to me when I forgot to add the table name to the parameters or 
> the schema name.
> 
> If you can give us more information we could help you.
> 
> > Please can someone give me an advice what could be wrong, or how to
> > investigate the problem deeply (for instance how to debug into code).
> > 
> > Using 4.5.2_01 still because the newest distro for linux doesn't contain a
> > designer binary ;-)
> > 
> > Regards
> > 
> > Jiri Mikulasek
> > 
> > AURA, s.r.o. Czech Republic
> > _______________________________________________
> > Qt-jambi-interest mailing list
> > [email protected]
> > http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
> 

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to