Hello,
I'm with problem in my UPDATE clause using placeholder (sqlite3). In some fields the placeholder return a incorrect data, even i verifying that the data that i send to UPDATE is correct.

Eg:the output from "query2.value(0).toInt()" is 2 (a integer value, like i expected), but the placeholder ":id_city" stores the following value: 1_city

Qt Code:
  1. QSqlDatabase con = QSqlDatabase::addDatabase("QSQLITE");
  2. con.setDatabaseName(_DB);
  3. con.open();
  4.  
  5. QSqlQuery query;
  6. // the problem occur ins some cases with different data types, like integer directly (0), query2 return and text from qlineedit, as with diferent object types (qlineedit, qcombobox, qcheckbox)
  7. query.prepare("UPDATE table SET id_country=:id_country, id_city=:id_city, name=:name ...... WHERE id=:id"
  8. query.bindValue(":id_country",1);
  9. query.bindValue(":id_city",query2.value(0).toInt());
  10. query.bindValue(":name",ui->QLineedit->text());
  11. .
  12. .
  13. .
  14. query.bindValue(":id",_ID);
  15. query.exec();
To copy to clipboard, switch view to plain text mode 

someone known where is the problem? could help me please?

Thanks!
Juliano