I am trying to use the SQLRowCount
function after the select query. MSDN document says SQLRowCount
doesn't work with the select query. So SQLRowCount
is returning -1 to me.
But what is the alternate way if I want to retrieve the count of resultset returned by the select query?
For e.g.:
SQLCHAR* selectQuery = (SQLCHAR*)"SELECT * FROM table";
retCode = SQLExecDirectA(hStmt, selectQuery, SQL_NTS)
if (SQL_SUCCEEDED(retCode))
{
SQLINTEGER numRows;
retCode = SQLRowCount(hStmt, &numRows);
}
The above code is running perfectly with mysql but with sql server numRows is getting -1 as a value. What are the alternate ways I have to get the count of number of rows returned by the select query in this case?