11 years ago
Using '@@ROWCOUNT' SQL query in TestComplete
Hello,
We are trying to create a test in which we utilize several sql queries and Update statements. As part of that process, upon executing an update statement we want to get the rowcount of rows affected for validation purposes.
The following query string works perfectly well in sql server management studio:
Update (table) set (column) = 1 where name = 'frmCodeImport' and security_role_id = 2 SELECT @@ROWCOUNT
When executing this string in TestComplete, like so:
Cmd["CommandText"] = dbquery;
RecSet = Cmd["Execute"]();
RecSet is returned as a blank object. There are no values contained in it, even though it should be returning the value given by @@rowcount. We have tried casting, using aliases, running the command alone, etc, all to no avail.
Is there some special way to execute the "select @@rowcount" command? Or something else that I can try, or have missed?
We are trying to create a test in which we utilize several sql queries and Update statements. As part of that process, upon executing an update statement we want to get the rowcount of rows affected for validation purposes.
The following query string works perfectly well in sql server management studio:
Update (table) set (column) = 1 where name = 'frmCodeImport' and security_role_id = 2 SELECT @@ROWCOUNT
When executing this string in TestComplete, like so:
Cmd["CommandText"] = dbquery;
RecSet = Cmd["Execute"]();
RecSet is returned as a blank object. There are no values contained in it, even though it should be returning the value given by @@rowcount. We have tried casting, using aliases, running the command alone, etc, all to no avail.
Is there some special way to execute the "select @@rowcount" command? Or something else that I can try, or have missed?