Solved

ApplyUpdates(0)

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

739 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