BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ClientDataset.EmptyDataset

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Anders Balslev
Guest





PostPosted: Sun Apr 29, 2007 11:00 pm    Post subject: ClientDataset.EmptyDataset Reply with quote



Hi

BDS 2660 Upd 2
MSSQL 2000

I have a Master/Detail relation between 2 tables.
MasterTable --> TDatasetProvider -->cdsMasterTable(TClientDataset)
DetailTable -->MasterSource(TDataSource)-->cdsMasterTable.DatasetField-->cdsDetailTable(TClientDataset)

When I want to delete all records in the detail table, which relates to a
certain Master record, I would like to call
cdsDetailTable.EmptyDataset

This works as long as I work in the clientdatasets, but it will not post the
changes to the table after call to cdsMasterTable.ApplyUpdates(0)

Any idea?

Of course I could call cdsClientTable.delete for each detail record, and
call subsequent to cdsMasterTable.ApplyUpdates(0) - this works, but it's not
as elegant as call to EmptyDataset

Anders
Back to top
Bill Todd
Guest





PostPosted: Mon Apr 30, 2007 3:24 am    Post subject: Re: ClientDataset.EmptyDataset Reply with quote



Anders Balslev wrote:

Quote:
this works, but it's not as elegant as call to EmptyDataset

Elegant or not it is the way to do what you want. As a general rule
methods that operate on the CDS will not be applied to the underlying
database while methods that operate on individual records will.

If you want elegant write a stored procedure that deletes the detail
records, call it, then close and reopen the master CDS.

--
Bill Todd (TeamB)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.