Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 274719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:39:12+00:00 2026-05-12T00:39:12+00:00

In the AfterPost event handler for a ClientDataSet, I need the information if the

  • 0

In the AfterPost event handler for a ClientDataSet, I need the information if the ApplyUpdates function for the current record will do an update or an insert.

The AfterPost event will be executed for new and updated records, and I do not want to declare a new Flag variable to indicate if a ‘update’ or ‘ insert’ operation is in progress.

Example code:

procedure TdmMain.QryTestAfterPost(DataSet: TDataSet);
begin
  if IsInserting(QryTest) then
     // ShowMessage('Inserting')...
  else
     // ShowMessage('Updating');

  QryTest.ApplyUpdates(-1); 
end;

The application will write a log in the AfterPost method, after ApplyUpdate has completed. So this method is the place which is closest to the action, I would prefer a solution which completely can be inserted in this event handler.

How could I implement the IsInserting function, using information in the ClientDataSet instance QryTest?

Edit: I will try ClientDataSet.UpdateStatus which is explained here.

  • 1 1 Answer
  • 5 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:39:12+00:00Added an answer on May 12, 2026 at 12:39 am

    ApplyUpdates doesn’t give you that information – since it can be Inserting, updating and deleting.

    ApplyUpdates apply the change information stored on Delta array. That change information can, for example, contain any number of changes of different types (insertions, deletions and updatings) and all these will be applied on the same call.

    On TDatasetProvider you have the BeforeUpdateRecord event (or something like that, sleep does funny things on memory 🙂 ). That event is called before each record of Delta is applied to the underlying database/dataset and therefore the place to get such information… But Showmessage will stop the apply process.

    EDIT: Now I remembered there’s another option: you can assign Delta to another clientdataset Data property and read the dataset UpdateStatus for that record.
    Of course, you need to do this before doing applyupdates…

    var
      cdsAux: TClientDataset;
    begin
      .
      . 
      <creation of cdsAux>
      cdsAUx.Data := cdsUpdated.Delta;
      cdsAux.First;
      case cdsAux.UpdateStatus of
        usModified:
          ShowMessage('Modified');
        usInserted:
          ShowMessage('Inserted');
        usDeleted:
          ShowMessage('Deleted'); // For this to work you have to modify  
                                  // TClientDataset.StatusFilter  
      end;
      <cleanup code>
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to post multi-line data via a hidden field. The data will be
I need to insert data from my parsed XML file to mySQL table. Problem
How could I add new menu after Post : media : Links : comments
I have an asp.net button: <asp:Button ID=MainContent_ibSave runat=server Text=Save /> </td> I need to
I need to retain the dropdown list value after post submit where the values
What is the best practice to protect model against unwanted parse/update after post in
function subVal() { if (document.forms['loginform'].name.value == '' || document.forms['loginform'].uid.value == '') { if (document.forms['loginform'].uid.value
I wrote the following jquery code to allow only numbers in a textbox. $([id$='txtPriority']).keydown(function
I'm trying to write a program that will be a BIOS option (after POST).
I have a page with jquery tabs in which the user can update their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.