Hello!

I want to transmit data to a SQLite database but this is done record
be record and takes much to long.

So I decided to use transaction(). But it is still working record by record,
so something must be wrong.

Can you tell me what is wrong?

Kind regards,
HomeR

This is the code:



Qt Code:
  1. QSqlDatabase dbSQL = QSqlDatabase::database();
  2. dbSQL.transaction();
  3. populateSQL(RemoteName,Purpose,DateString,value,currQString);
  4. dbSQL.commit();
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. int Banking::populateSQL(QString RemoteName,QString Purpose,QString Date,double Value ,QString Currency)
  2. {
  3. QSqlQuery query;
  4.  
  5. query.prepare(
  6. "INSERT INTO onlinebankingdata ("
  7. "RemoteName,"
  8. "Purpose,"
  9. "Date,"
  10. "Value,"
  11. "Currency)"
  12. "VALUES ("
  13.  
  14. ":RemoteName,"
  15. ":Purpose,"
  16. ":Date,"
  17. ":Value,"
  18. ":Currency)");
  19.  
  20.  
  21. query.bindValue(":RemoteName", RemoteName);
  22. query.bindValue(":Purpose", Purpose);
  23. query.bindValue(":Date", Date);
  24. query.bindValue(":Value", Value );
  25. query.bindValue(":Currency", Currency);
  26.  
  27.  
  28.  
  29. bool test = query.exec();
  30. if (!test)
  31. {
  32. QMessageBox::warning(0, QObject::tr("Database Error"),query.lastError().text());
  33. }
  34.  
  35. return 0;
  36. }
To copy to clipboard, switch view to plain text mode