Receiving multiple result sets of return value in SQL server stored procedure from Qt (QSqlQuery)
-
I'd look at
nextResult
which is likely the place that is going to load data from the query made. -
@SGaist Yesss! calling it solved my problem. Thanks :)
-
I'm not sure I'm following you on that one, can you clarify what you did ?
-
Sorry, I'm a bit late to the party. But http://doc.qt.io/qt-5/qsqlquery.html#nextResult is indeed, and always been, the way you move across multiple result sets (assuming your database supports them). Even in my non-Qt work with MS SQL Server this was how it worked there too.
-
@SGaist I've just called QSQLQuery::nextResult after executing and reading dataTable. Then I was able to read another result sets.
-
@JonB Yes, I was not familiar with that. Also in QSqlQuery doc, there was some disappointing states that the multiple result sets might not be supported.
-
So in the end, did you had to modify the driver for your stored procedure ?
-
@SGaist Not at all.
-
So just looping with
QSqlQuery::next
got you the result of the stored procedure as expected ? -
@SGaist I did it this way for reading return params:
Query.nextResult(); // after reading table values //Get Return Parameter for (int i=0; i<CountReturnParam; i++) { qDebug() << QString("Returnparam %1 = %2") .arg(i).arg(Query.boundValue(i).toString()); }
17/17