Hello there,

I'm trying to search a special value into my database but it just doesn't want to get there.
I'm using QSQLITE to connect to my database and i'm using the following code to reach a value :

Qt Code:
  1. void DbManager::printCommande(int id)
  2. {
  3. QSqlQuery query("SELECT * FROM commandes WHERE id=(:id)");
  4. query.bindValue(":id", id);
  5. int idId = query.record().indexOf("id");
  6. int idmagasin = query.record().indexOf("idMagasin");
  7. int idclient = query.record().indexOf("idClient");
  8. int idDate = query.record().indexOf("date_commande");
  9. int idEmploye = query.record().indexOf("EmployeResponsableVente");
  10. int idPaiement = query.record().indexOf("mode_paiement");
  11. while (query.next())
  12. {
  13. QString name = query.value(idId).toString();
  14. qDebug() << name;
  15. QString magasin = query.value(idmagasin).toString();
  16. qDebug() << magasin;
  17. QString client = query.value(idclient).toString();
  18. qDebug() << client;
  19. QString date = query.value(idDate).toString();
  20. qDebug() << date;
  21. QString employe = query.value(idEmploye).toString();
  22. qDebug() << employe;
  23. QString paiement = query.value(idPaiement).toString();
  24. qDebug() << paiement;
  25.  
  26. }
  27. }
To copy to clipboard, switch view to plain text mode 

I've looked for a bit for a soluton but everywhere i've looked for the previous code worked for everybody but not me so i'm quite in a bind here.
I checked if it would work if I changed the (:id) into an int and it worked so I guess it's how I call the id that causes problems but i quite don't get it.

thanks in advance for your help