DataWindow error: row change between checkout and update

I get an error when updating a DataWindow that says: "The row was changed between restore and update." What is the solution?

+6
powerbuilder datawindow
source share
7 answers

This can happen if you show the same rows in several (not common) DataWindow, and then try to update them. Other causes are misuse of SetItemStatus (); improper use of status flags in the update () statement; and finally, the reason it is intended to be discovered, another user updated the line in front of you.

+5
source share

This usually means that some kind of column that you included in the update, where the proposal is updated elsewhere, for example, through a trigger. other reasons include a non-empty empty row set for row columns when talking to the oracle. oracle converts any empty string sent to it to zeros, so a subsequent update will not find the same string unless you tell pb to consider it null. look at the columns you told pb to include in the where clause (in the update specifications) and make sure that they are indeed the columns you need to have.

+2
source share

Was it allowed? There are several reasons why this could happen, for example, if the row was updated by another user. In the update properties of your data object, you can select the update method, using either the key value and the changed values, or the key and all updated columns.

If you are sure that there are no problems with concurrency, you can change this parameter to "use only the key value". It will make the where clause for updates only the key value, and other columns will not be evaluated for changes.

This can happen if validation errors occur, you need to remember that the status of the item does not change. To set all unchanged rows, you should do dw_1.setitemstatus (1,0, Primary !, NotModified!), If my memory is correct, so that all the columns for the first row are unmodified !. You can also execute ResetUpdate () or Reretrieve data.

hope this helps. Rich

+1
source share

This can also happen if you have two rows of data that update one row or rows of the database.

(Not very good) Example:

There is no primary key in the table, but datawindow uses DateOfBirth.

  Name: Dennis Miller
    DateOfBirth: 19531103
    Vocation: comedian
  Name: Kate Capshaw
    DateOfBirth: 19531103
    Vocation: actress

Note that Dennis and Kate have the same DateOfBirth.

Suppose these changes are made

  Name: Mr.  Dennis miller
  Name: Ms.  Kate capshaw

When dw_1.update () is called, the following message appears:

  "Row changed between retrieve and update"

because each row was updated twice, first by Dennis Miller, and then with Ms. Kate Capshaw

+1
source share

I understand that this is an old question, but I decided that I would add my own solution if it helps anyone. In my case, datawindow issued an UPDATE , and when this statement was executed in the SQL management studio, the columns returned as expected. However, the query was shown twice where (1 row affected). The trigger updated a row that was not associated with the table being updated. Adding SET NOCOUNT ON to this trigger resulted in 1 instance where (1 row is affected) and the row changed between the extraction and the update is fixed.

0
source share

Another possibility is that the datawindow column definition does not match the database column definition.

Example:

  • columnA is defined in the database as char (10)

  • datawindow is built with column A as char (10)

  • columnA changed to char (20) in the database

  • data is added externally to column A with more than 10 characters.

  • datawindow extracts truncations up to 10 characters (with or without error, depending on application settings.)

  • a delete / update line may cause the line to change between restore and update

0
source share

This behavior is controlled by the "Update Properties" of your data window and, more specifically, part of the Where clause for updating / deleting. This controls the where clause that Powerbuilder will use after update.deleting, as you might check with the SQLPreview event of your Datawindow:

  • Key columns: only key columns are used in the where clause. If you use this, you run the risk that some columns were changed elsewhere (not necessarily PowerBuilder) between your search and your update. Only the latest update will remain in the database. Of course, if the key columns themselves have been changed, you will receive a "Row changed" message.
  • Key and updated columns: on top of the keyword columns, you add all updated columns, as defined below, in the "Updated columns" field. Whenever a column has been changed (again, not necessarily using Powerbuilder), the row will not be restored, and you will receive a "Row changed" message. In many cases, this is an excess.
  • Keys and Modified Columns: Only columns modified for a particular row are added to them.
    Now it's up to you to choose one of them, depending on the specific context of your application.
0
source share

All Articles