Solved

TClientDataSet.ApplyUpdates

Posted on 2004-09-20
3
857 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
[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
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

Independent Software Vendors: 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

Title # Comments Views Activity
Working with hours 3 87
Controlled Assessment GCSE - desperate help needed 4 121
Find and Replace Stream with 0s 8 86
Way to create an iPhone app for my customers 8 89
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

732 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