Dan Thomas Guest
|
Posted: Thu Feb 12, 2004 9:11 pm Post subject: Cancel a TADOQuery-TProvider-TClientDataSet Open against MSS |
|
|
Preamble: I've done an exhaustive newsgroup search on this. I've spent weeks
trying different things I've read. I'm still stuck...
I have an application that has a TClientDataSet hooked to a TProvider hooked
to a TADOQuery. The query is running against an MSSQL 2K server. The result
set could be large, depending on what options the user specifies.
After I do ClientDataSet.Open (but before it returns), and after the
ADOQuery starts returning records, I'd like to be able to cancel the "Open"
(in other words, stop transferring records from the Server through the Query
into the CDS).
I almost got this to work right. I put code in the ADOQuery.AfterScroll
event that checks to see if the user clicked a Cancel button. If they did, I
call ADOQuery.Recordset.Cancel. This appeared to work, except for one thing:
it took just as long as if I hadn't canceled it. When I checked the network
Performance Monitor, it was obvious the ADOQuery was still retrieving
records from MSSQL.
I've read lots of stuff in these newsgroups about doing portions this. As
far as I can tell, none of the things I've read work against an MSSQL 2K
database.
If anyone has had success in doing this against an MSSQL 2K database, please
tell me how you did it. Tell me what properties you set, etc. I would be
sooooooo grateful!!!!
Dan Thomas
PS: If you can figure out how to cancel the ADOQuery before it starts
returning records, that would be cool also, but I've just about given up on
that (against an MSSQL 2K server).
PPS: Delphi 7 or 6.
|
|