Hi everyone,
I'm working on a Qt application that interacts with a SQL database Server.Je want tocompare two fields retrieved from the database.
But there will always be an error in the comparison.
When I view the fields in the console.
The first is displayed correctly. (An integer)
But the second is displayed as a hex shape I think. Example: if the retrieved value is'1 ', the value is '0 x6a112f16'.
Here is a portion of the code:
Qt Code:
  1. QSqlQuery query11;
  2. query11.prepare("SELECT Seuil_Min FROM Projet.dbo.Produit WHERE Nom=:nom");
  3. query11.bindValue(":nom", ui->comboBox->currentText());
  4. if (query11.exec() && query11.next()) {
  5. ui->textBrowser->setText(query11.value(0).toString());
  6. qint8 min=query11.value(0).toInt();
  7.  
  8. QSqlQuery query12;
  9. query12.prepare("SELECT Quantité FROM Projet.dbo.Produit WHERE Nom=:nom");
  10. query12.bindValue(":nom", ui->comboBox->currentText());
  11. if (query12.exec() && query12.next()) {
  12. qint8 qt = query12.value(0).toInt();
  13. qDebug()<< qt;
  14. qDebug()<< min;
  15. }
  16.  
  17.  
  18. if(qt <= min){
  19. QMessageBox::warning(this,"Information","Vous avez atteint le seuil minimal de ce produit. Un message d'alerte sera envoyé au système centrale !");
  20. }
To copy to clipboard, switch view to plain text mode