hi to all, I've Centos7.5 as client and centos6.10 as mysql server. i am building small project and here i want to get maximum value from billno ( bill number ). I've tried this code :-
Qt Code:
  1. int Sales::setmaxno()
  2. {
  3. QSqlQuery qury;
  4. QString sql= "select max(billno) from tableSale";
  5.  
  6. query->prepare(sql);
  7. if(query->exec() )
  8. {
  9. if(qury.next())
  10. {
  11. Sales::maxno = query->value(0).toInt();
  12. return Sales::maxno;
  13. }
  14. }
  15. else
  16. {
  17. QMessageBox::information(this, "Sales", "in else " + query->lastError().text() );
  18. }
  19. }
To copy to clipboard, switch view to plain text mode 

but this shows maxno = 0; always.
i think query "select max(billno) from tableSale"; is not selecting max of column.
how to get solved this problem.