Solved

TClientDataSet.ApplyUpdates

Posted on 2004-09-20
3
846 Views
Last Modified: 2008-03-06
Hi.

I update some data using the TClientDataSet.ApplyUpdates(0) method (TClientdataSet is connected to a TDataSetProvider which is connected to a TQuery).  This method returns the number of errors that occured while executing.

My question is simple :  how can I know what error actually did occured ?

Thanks :)
0
Comment
Question by:qas
  • 2
3 Comments
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 12110008
do it like this:

  try
    ClientDataSet1.ApplyUpdates(0);
  except
    on E: Exception do
      begin
        MessageDlg(E.Message, mtError, [mbOK], 0);
        Exit;
      end;
  end;

  E.Message will give the exception error message, which is detailed error.
0
 

Author Comment

by:qas
ID: 12111472
Hi.

Thanks for the comment.

The thing is that ClientDataSet1.ApplyUpdates(0) is a function returning an integer which is the number of errors that occured while updating the dataset.  Though I haven't tried it yet, I do believe that the actual call of this method CAN raise an exception (like if the dataset is locked or unavailable) but that is not what I'm really looking for.

For example, lets say the function returns 3.  I want to know what actully are those 3 errors that occured.

Thanks :)
0
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 50 total points
ID: 12112631
in your case "ClientDataSet1.ApplyUpdates(0);" you send 0 for MaxErrors. This means if there is more than 0 errors, for e.g. 1 - you will go into the "except" block. There you have E.Message.

If you have more than 1 errors, you have to work with Reconcile method. Handle the errors in OnReconcileError.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

863 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

23 Experts available now in Live!

Get 1:1 Help Now