 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Anders Balslev Guest
|
Posted: Sun Apr 29, 2007 11:00 pm Post subject: ClientDataset.EmptyDataset |
|
|
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
|
Posted: Mon Apr 30, 2007 3:24 am Post subject: Re: ClientDataset.EmptyDataset |
|
|
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 |
|
 |
|
|
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
|
|