Solved

ApplyUpdates(0)

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

759 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

20 Experts available now in Live!

Get 1:1 Help Now