If you have parent child relationship, on the "Before delete" event of
the parent record, delete the dependent child records.

Here is some sample code:

procedure TDM.ChartMasterTblBeforeDelete(DataSet: TDataSet);
begin
ChartDetlTbl.DisableControls;                         //stop scrolling
of records
Try
ChartDetlTbl.First;                                             //Go to
first record in list
While Not ChartDetlTbl.eof do ChartDetlTbl.Delete;    //Remove all child
records
Finally
ChartDetlTbl.enableControls;                                    //turn
on grid controls
end;
end;


Hope this helps!

Tom Nesler

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Alan Colburn
Sent: Wednesday, June 25, 2008 2:24 PM
To: delphi-db@elists.org
Subject: Clearing a Nested Field


I have parent child datasets--CDSParent and CDSChild. CDSChild is
displayed in a DBGrid. How would I clear the contents of CDSChild for
the current record, yielding an empty looking grid? 
 
I've tried several methods which seem like they should work, but no luck
so far. (I'm unsure whether I'm doing something wrong, or if I've got
something going on elsewhere in my code that I should be looking for.)
 
Thanks, as always -- Al C.
_________________________________________________________________
Earn cashback on your purchases with Live Search - the search that pays
you back!
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=earnca
shback
_______________________________________________
Delphi-DB mailing list
Delphi-DB@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-db
_______________________________________________
Delphi-DB mailing list
Delphi-DB@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi-db

Reply via email to