PDA

View Full Version : QSqlRelationalTableModel get error: constraint failed unable to fetch row



Kevin Hoang
29th March 2010, 15:23
I'm using QSqlRelationalTableModel and QtableView to insert data to SQLite Database, I get an error message: constraint failed unable to fetch row; when I insert data into table has Relation. I don’t know how to fix this problem.

Help me!

Kumosan
29th March 2010, 15:58
Very hard to tell without seeing your database schema and what you are doing. Clearly you try to do something, which is forbidden in your schema, e.g. insert a 0 in a column, which has the constraint 'NOT NULL', or adding duplicate values in a column with the constraint 'UNIQUE'. Unfortunately SQLite is not able to tell exactly which constraint you are violating and why.

Kevin Hoang
30th March 2010, 04:23
I understand SQL works. I’m sure that no cases like you said above.