I have a Datawindow called dw_1 with Two tables Table1 Left Join Table2
. I am retrieving the dw_1 with some retrieval arguments (For Eg. 100 rows retrieved), after that I am Modifying some 10 rows in the dw_1 Table2's Columns. And I am calling dw_1.Update()
, I am getting the below error.
Database: SQL Server
Row changed between retrieve and update. No changes made to database. DELETE FROM Table2 Where Col1 IS NULL And Col2 IS NULL And Col3 IS Null;
My Update Properties are
Table to Update : Table2
Where Clause for Update/Delete : Key Columns
Key Modification : Use Delete Then Insert
Updatable Columns : All Columns of Table2
Unique Key Columns : Primary Key Columns of Table2
Identity Column : (None)
When data comes back from the database, it is stored in the Original! DataWindow buffer, in part to pull values from to build the WHERE clause when a DW’s Update() is called. When one of those DML calls returns that zero rows are affected, the DW raises a “Row Changed” error (known as logical record locking to handle multi-user contention).
When a “Row Changed” error comes up when it’s not true, it’s usually because someone has been programmatically making changes to data in the Original! buffer without understanding completely how that data is used. The result is that the DW is building the WHERE clause with the wrong values.
The alternative is to believe the 3 primary key columns of table 2 were retrieved from the database as nulls, which is a completely different red flag. If you’re sending updates for rows that had no data in table 2… well, that seems wrong. If you’re trying not to update those DW rows, use DiscardRow(), which will make the DW “forget” the row, instead of DeleteRow(), which will trigger a DELETE statement.
Good luck.