Q:

Powerbuilder - SQLNRows is 0 after Datawindow update

The first time I call Update on my DataWindow it returns 1 (success) and SQLCA.SQLNRows is 1. When I do a second update on the same screen without closing it in between, Update returns 1 and SQLCA.SQLNRows is 0. Any suggestions why this is happening?

A:

Your question seems to hit a couple of things.
Firstly, as John Paul mentions, Update() will return 1 even if there are no rows updated. There is no specific return value for "nothing to be done."
Secondly, as mentioned in the help file, the value for SQLNRows is DBMS-dependent, so it's hard to comment on the value being filled in there without knowing the DBMS involved. However, regardless of that, since the DataWindow issues a series of INSERTs, UPDATEs and DELETEs that are targeted at only one row, if this value is populated I wouldn't expect it would ever be more than one, no matter how many SQL statements the DataWindow issues. The number of rows affected for the last SQL statement issued should always be one.
If you're trying to find the number of rows affected by a DataWindow Update(), before the Update(), check the value of ModifiedCount() + DeletedCount(). 
Good luck,
Terry.

