whoops.slo
27th August 2006, 09:41
Hi!
In my code I have several QSqlQuery statements, each has different name and are used for selecting data and updating that data. When I select data from a table using the select query I caould not update that same table using update query until I cleared that query using QsqlQuery::clear(). Why is that necessary?
Example code (not necessary working, just to see what I meant):
QSqlQuery q_select1("SELECT * FROM table1 WHERE number LIKE '1'");
int i_word = q_select1.record().value("word");
q_select1.next();
QString s_word = q_select1.value(i_word);
q_select1.clear();
QSqlQuery q_update1("UPDATE table1 SET word = 'new word' WHERE number = '1'");
Why the q_update1 did not work until i put q_select1 there?
Thanks!
Luka
In my code I have several QSqlQuery statements, each has different name and are used for selecting data and updating that data. When I select data from a table using the select query I caould not update that same table using update query until I cleared that query using QsqlQuery::clear(). Why is that necessary?
Example code (not necessary working, just to see what I meant):
QSqlQuery q_select1("SELECT * FROM table1 WHERE number LIKE '1'");
int i_word = q_select1.record().value("word");
q_select1.next();
QString s_word = q_select1.value(i_word);
q_select1.clear();
QSqlQuery q_update1("UPDATE table1 SET word = 'new word' WHERE number = '1'");
Why the q_update1 did not work until i put q_select1 there?
Thanks!
Luka