Solved

ApplyUpdates(0)

Posted on 2008-10-28
6
638 Views
Last Modified: 2013-11-11
I have a BCB program that accesses an Oracle 11g database. When trying to change a value in a table, the AfterPost event is shown below. When the Line AccountsCDS->ApplyUpdates(0); is run, an error appears "Record locked by another user" even if no-one else is using the database at all. This happens also with other tables.

Does anyone have an idea what this might be?

Thanks,

Phil

void __fastcall TRHPMSDataModule::AccountsCDSAfterPost(TDataSet *DataSet)
{
 AccountsCDS->ApplyUpdates(0);
  try {
      AccountsCDS->RefreshRecord();
      AccountsTable->Active=true;
  } catch (...) {
    // TODO: has to be logged
  }
}

Open in new window

0
Comment
Question by:prutovitz
  • 2
6 Comments
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 22824569
I think this is because the AfterPost event has the table still open.  I put applyupdates as a command after the post command, and this works fine.
0
 
LVL 31

Expert Comment

by:moorhouselondon
ID: 23217442
>I have recommended this question be closed as follows:
>Delete with no refund

I have tested my answer and can assure you that putting applyupdates(0) inside the AfterPost event causes the program to crash.  The correct way to ApplyUpdates is in the main code, as follows:-

AccountsCDS.post;
AccountsCDS.applyupdates(0);
0
 

Accepted Solution

by:
prutovitz earned 0 total points
ID: 23217588
Sorry I did not respond earlier. Actually the solution in this case was to set the ProviderFlags pfInWhere and pfInKey to true in the Client Dataset.

Thanks for paying attention to this comment. I will strive to respond more quickly in the future...
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to recover a database from a user managed backup

785 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