Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error - 'Row changed between retrieve and update' ?

Status
Not open for further replies.

kaul125

Programmer
Jan 29, 2002
87
US
I have an window in my application that allows for adding new clients. After I fill in the fields for a new client, I have a save button. After clicking on this save button it performs various editing checks and issues an update to the database. This works fine when you first open this window and add the info for the client.

However, after clicking on the save button and without closing the window let's say I want to change some information. I go ahead and change 1 or more fields and click on the save button again. This time I get an database error, which states:

Row changed between retrieve and update. No changes made to database.

It also, displays the update statement but with each field set to blank or 'is null'

My datawindow update properties are set to:
Key and updateable columns
Use Delete then Insert

I'm us PB6.5 .

What is causing this error and how can I correct the problem?

Thanks,

Keith
 
It depends on how you are using the update method

If it is dw_1.Update(True,False) which means that you are not resetting the update flags, then you have to follow it up with dw_1.ResetUpdate() and a commit.

Also, if you have only 1 record in the datawindow and the retrieval time is not high, you can also go for a refresh of the datawindow after save

dw_1.Reset()
dw_1.Retrieve(client_code)

Normally this problem comes in multiuser scenarios where some other user has modified the record on which you are working. In a single user scenario this will come only if the datawindow flags have not been properly set/reset after an update command.

Hope it will help. Hope your earlier problem of conditional color of detailed band is solved. Trt to give a feedback on the status of your problems as this is an equal opportunity for us to learn how various problems got solved. RT
 
The best way to avoid the "row changed between retrieve and update" error is to use the "Key columns" update option. If you have timestamps or fields updated by triggers including them in the update statement ("Key and updateable columns") can cause you problems.

Cheers.
 
Thanks for your help on this issue. I implemented your suggestions and it worked fine.

RT, sorry for not posting the status on my other issue regarding changing the row color. Your suggestion did work. However, under certain circumstances, it was not working properly. I will look at it again and post my status in a few days.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top