SQL query working fine in whole program but not showing any data in one function

90 Views Asked by At

I am working on a QT project. I am writing following query. There are many other queries in the project. All of them are working except this one. I have check all the names and also tried running simple query but nothing is working. I am attached the code for reference. Here rqry.size() returns -1. Can Anyone suggest possible solution?

Thanks.

if(db.Connect()){
       QSqlQuery rqry;
       if(rqry.prepare("SELECT first_weight.fID, first_weight.supplier, first_weight.party, "
                       "first_weight.vehicle_no, first_weight.f_weight, first_weight.fdate, "
                       "first_weight.ftime, second_weight.s_weight, second_weight.sdate, "
                       "second_weight.stime, second_weight.net_weight "
                       "FROM first_weight, second_weight")){

           rqry.exec();
       }
       rqry.next();
       qDebug() << rqry.size();
0

There are 0 best solutions below