Solved

TClientDataSet.ApplyUpdates

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

717 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