I exec a statement SQL in MYSQL Workbench and result is: 2 ; pic:

2.jpg

But in C++ QT I do not know how to get the value like MYSQL, I try this code and result not is: 2

Qt Code:
  1. void QuanLyDaiLy::on_pushButton_clicked()
  2. {
  3. QSqlQuery *qry = new QSqlQuery();
  4. qry->prepare("select count(MaDaiLy) as SoDaiLyTrongQuan from DaiLy, Quan where DaiLy.Quan_TenQuan = Quan.TenQuan and Quan.TenQuan = 'Quan 10'");
  5. qry->exec();
  6.  
  7. QMessageBox::information(this,"result",QString::number(qry->size()));
  8. }
To copy to clipboard, switch view to plain text mode 

1.png

what can I use to QString::number(qry->????????) to get the value ?

Thanks for help .