Solved

Another User Changed Data

Posted on 1998-01-30
15
220 Views
Last Modified: 2010-04-04
I am writing a Delphi 1.0 application.  I am getting the following error when I try to save changes to a record:  "Cannot perform edit because another user has changed the data."  No one else is using the application.  Anyone have any ideas on what is causing the error and how to stop it.
0
Comment
Question by:oasys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
15 Comments
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358037
Is another application using the same table?
0
 

Author Comment

by:oasys
ID: 1358038
No, no other applications are using the table.  We are developing the database also, so we are using test data.  You get the error under several circumstances.  It seems give this error after all required fields are saved and then you try to add data to fields that are not required and save again. On one form, we have a state field that is required.  If you delete the state and save the form, you do not get the error.  If you add the state back and try to save it, you will get the error.  Any ideas?

 
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358039
After you edit a record do you call post?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:oasys
ID: 1358040
I do call post after the edit.  I have went so far as to call post and commit.  I get the same error.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358041
What database are you using? Try to call refresh before rediting.
0
 

Author Comment

by:oasys
ID: 1358042
I am using an Oracle database.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358043
Oracle 8.0?
Are you using cached updates?
0
 

Author Comment

by:oasys
ID: 1358044
We are using Oracle 7.3.3.0.0 and Oracle 7.3.2.3.0

We are not using cached updates.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358045
OK, After you call post, call Refresh and tell me if you still get the error.
0
 

Author Comment

by:oasys
ID: 1358046
My boss says he has already tried the refresh after post and he still got the error.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358047
Did you try to close and reopen the table immidiatly after posting?
0
 

Author Comment

by:oasys
ID: 1358048
We have not tried closing and reopening the table.  If we do that we will have to do a search to bring up the record that we have just edited.  The application is large and database will have so many records that the search will cause the performance of the application to suffer.  
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1358049
Yes, I know, just for the test. Also before you reedited the record you verified that the table was in browse state?
0
 

Author Comment

by:oasys
ID: 1358050
If you close the table and open it back up, you do not get the error.  Delphi doesn't seem to release the record after the save. So if you try to edit right after the save, it tells you it cannot perform the edit.
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1358051
The only solution I think of is Enabling cached updates just before editing and posting, then disabling it again immidiatly after commiting data.
Example:

with Table1 do
try
  CachedUpdates:=True;
  Edit;
  do somthing...
  Post;
  CommitChanges([Table1]);
Finally
  CachedUpdates:=False;
end;  


function CommitChanges(FTable: Array of TTable): Boolean;
var I: Byte;
begin//committing table's changes to the database
  FTable[0].Database.StartTransaction;
  try
    for I:=Low(FTable) to high(FTable) do
      if FTable[I].CachedUpdates then
        FTable[I].ApplyUpdates; {try to write the updates to the database};
    FTable[0].Database.Commit; {on success, commit the changes};
  except
    FTable[0].Database.Rollback; {on failure, undo the changes};
    raise;//raise the exception to prevent a call to CommitUpdates!
  end;
  for I:=Low(FTable) to high(FTable) do
    if FTable[I].CachedUpdates then
      FTable[I].CommitUpdates; {on success, clear the cache}
  Result:=True;
end;


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
find a node in VST 2 79
Delphi IDE crash without error message ... 7 120
Delphi...Split view - idea? 1 117
Installshield for Embarcadero EX 10.1 Berlin 4 74
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question