Re: QSqlTableModel Questions
Quote:
Originally Posted by munna
1. setFilter(cosnt QString &)
How can I set more than one filter ? Ex: first_name = 'something' and last_name = 'another'
Code:
setFilter("first_name = 'something' and last_name = 'another'");
Quote:
2. insertRecord(int row,......) and setRecord(int row,.......)
Is the row number related to the current query or the table?
It is related to the model. row represents the index of the model.
Quote:
Where would the new row get added in the database?
Depends on the row you enter and the way the underlying database works. For most uses -- "at the end".
Quote:
How should the primary key be generated for the new record?
It should be autogenerated by the database or by your model's "insertRow()" (if you use a custom model).
Re: QSqlTableModel Questions
when i set a filter, my model changes. rite?
Re: QSqlTableModel Questions
No. You have to call select() to update the model.