Solved

ApplyUpdates(0)

Posted on 2008-10-28
6
644 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
[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
  • 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
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.

756 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