How to check for number of rows affected
Hi,
In My SQL there is a function which returns the number of rows which were affected by the last executed sql statement. MS SQL doesn't seem to have an equivalence and in my code which performs an 'update' I can't determine whether the sql statement actually did any updating or not. Can anyone offer any siggestions?
The followng code returns the same result whether the Update statement did anything or not...
sprintf(buffer, "UPDATE loginfo SET msg='goodbye' where code=122");
dbcmd (dbproc, buffer);
if(dbsqlexec (dbproc) == FAIL)
{
cout << "dbsqlexec failed" << endl;
return 0;
}
dbret = dbretstatus(dbproc);
cout << "dbretstatus()=" << dbret << endl;
cout << "dbsqlexec succeeded" << endl;
result_code = dbresults(dbproc);
cout << "result code = " << result_code << endl;
result_code = dbresults(dbproc);
thanks,
Dave
|