2

Sometimes in my application the open command of a ClientDataSet takes a long time, and I'd like to cancel that activity, something like a "break"or "abort".

I can explain: I've an animation every time I get "ClientDataSet.Open", but when it take so long I'd like offer to user the abort feature.

How can I do that? Thanks a lot.

  • If you're opening the CDS in your application's main thread, whether you can abort the .Open, and how, depends on where you're loading the data from. Another possibility is to load the data into a temporary CDS in a background thread and then assign its Data property to your CDS via a thread Synchronize call. That way you can abort just by posting a custom abort message to your background thread (and processing it in the thread before it gets to the Synchronize call). – MartynA Oct 23 '13 at 15:11
  • Not sure how to cancel the .Open once it's already begun, but I suppose if you run it in a worker-thread then you could kill that thread (make your abort button set the Terminated flag on the worker-thread). If you ask me... (She ain't worth it - Glen Medeiros) www.youtube.com/watch?v=M2BW9IKyc0A – Sam Oct 23 '13 at 23:01
  • I open my ClientDataSet's in a thread... – Lucas Medeiros Oct 28 '13 at 18:56
  • What kind of components you are using to provide data to `TClientDataset`? IBX, dbExpress, other? Are you using a DatasetProvider or another method? You must give more info. – EMBarbosa Oct 30 '13 at 17:39
  • @EMBarbosa I'm using dbExpress, TDataSetProvider and Firebird 2.5. – Lucas Medeiros Nov 01 '13 at 12:46
  • I'm not sure what is your problem yet. You will need to be clearer on your problem and your requirements, maybe providing code examples. If you already has an ClientDataset in a thread, why you don't just exit the thread after execution? See [this question](http://stackoverflow.com/questions/11277860/do-i-need-tthreads-if-so-can-i-pause-resume-and-stop-them) – EMBarbosa Nov 01 '13 at 17:24
  • Hi, have a look at firebird's MON$ tables (I.E: Select * from MON$STATEMENTS) it's only availible in firebird 2.1 and above if I'm not mistaken. http://www.upscene.com/documentation/fbtm2/index.html?dm_monitoringtables.htm – Ryno Coetzee Apr 15 '14 at 09:10

0 Answers0