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
void QuanLyDaiLy::on_pushButton_clicked()
{
qry->prepare("select count(MaDaiLy) as SoDaiLyTrongQuan from DaiLy, Quan where DaiLy.Quan_TenQuan = Quan.TenQuan and Quan.TenQuan = 'Quan 10'");
qry->exec();
}
void QuanLyDaiLy::on_pushButton_clicked()
{
QSqlQuery *qry = new QSqlQuery();
qry->prepare("select count(MaDaiLy) as SoDaiLyTrongQuan from DaiLy, Quan where DaiLy.Quan_TenQuan = Quan.TenQuan and Quan.TenQuan = 'Quan 10'");
qry->exec();
QMessageBox::information(this,"result",QString::number(qry->size()));
}
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 .
Bookmarks