Solved

Another User Changed Data

Posted on 1998-01-30
15
215 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
  • 8
  • 7
15 Comments
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
Is another application using the same table?
0
 

Author Comment

by:oasys
Comment Utility
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
Comment Utility
After you edit a record do you call post?
0
 

Author Comment

by:oasys
Comment Utility
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
Comment Utility
What database are you using? Try to call refresh before rediting.
0
 

Author Comment

by:oasys
Comment Utility
I am using an Oracle database.
0
 
LVL 5

Expert Comment

by:ronit051397
Comment Utility
Oracle 8.0?
Are you using cached updates?
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:oasys
Comment Utility
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
Comment Utility
OK, After you call post, call Refresh and tell me if you still get the error.
0
 

Author Comment

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

Expert Comment

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

Author Comment

by:oasys
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now