Solved

ApplyUpdates(0)

Posted on 2008-10-28
6
643 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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
Delphi: ForceDirectory plain function 7 42
Oracle dataguard 5 41
How to Get Images From Server using App Tethering 11 39
Slow Restore if incremental backups using RDiff.exe 4 29
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

792 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