Zander87
26th February 2011, 12:12
Hello
I've got following problem since a week:
I have a QSqlTableModel that I use to view data from a database in a calendar
model=new QSqlTableModel(0,db);
query=new QSqlQuery(db);
db is a QSqlDatabase
When i want to make a query from the database using a SQL statement i use " query" that is connected to db
When i want to insert record i proceed like that:
I create a QSqlRecord that contains values of the new record then I call
model->insertRecord(-1,record)
The problem is that although the recording is successfull (when closing the programm and re-open it i can see it) but it seems like the database would be updated only when closing it because i can not see it through a query just after insertion although i call model->submitAll after each insertion .. and trying different EditStrategy..
Any ideas? Don't hesitate to give me advice on how to do it easier as i'm not very good with Programming
I've got following problem since a week:
I have a QSqlTableModel that I use to view data from a database in a calendar
model=new QSqlTableModel(0,db);
query=new QSqlQuery(db);
db is a QSqlDatabase
When i want to make a query from the database using a SQL statement i use " query" that is connected to db
When i want to insert record i proceed like that:
I create a QSqlRecord that contains values of the new record then I call
model->insertRecord(-1,record)
The problem is that although the recording is successfull (when closing the programm and re-open it i can see it) but it seems like the database would be updated only when closing it because i can not see it through a query just after insertion although i call model->submitAll after each insertion .. and trying different EditStrategy..
Any ideas? Don't hesitate to give me advice on how to do it easier as i'm not very good with Programming