General information
Category:
The Mere Mortals .NET Framework
Title:
Parent-Child Delete?
I have a parent with children and grandchildren.
'Set the child and parent relationship between the CaseHeader table and the ReportReturnSum table
Me.oCaseHeader.RegisterChildBizObj(oReportReturnSum, "ReportReturnSum")
'Set the child and parent relationship between the ReportReturnSum table and the ReportReturnHeader table
Me.oReportReturnSum.RegisterChildBizObj(oReportReturnHeader, "ReportReturnHeader")
I have these properties set on the "ReportReturnHeader" and "ReportReturnHeader" BO's with different "ForeignParentKeyField" names:
Me.AutoSaveOnParentSaved = True
Me.AutoCancelOnParentCancel = True
Me.AutoDeleteOnParentDeleted = True
Me.ForeignParentKeyField = "rrh_rrsGUIDFK"
I want to delete all of the "ReportReturnSum" records for the current "CaseHeader" record. This works great. I call the delete and all of my "ReportReturnSum" records for the current CaseHeader record are deleted.
Since I have the above properties set to true, the parent-child relationship set, and the ForeignParentKeyField set I was expecting the "ReportReturnSum" records to delete their children ("ReportReturnHeader") records. This is not happenning.
I am not deleting the "CaseHeader" record. I only want to delete its child records in the "ReportReturnSum" table and have the "ReportReturnSum" table delete it's children.
In the "ReportReturnSum" BO I have the follwing code to retrieve the data to delete:
'Get a dataset of the data we want to delete
Me.GetEntityList("Select * From ReportReturnSum Where rrs_chdGUIDFK = @CasePK", Me.CreateParameter("@CasePK", CasePK))
'Delete the Report Return Sum data that belongs to the current case so we can import the new Report Return Sum data from the import file
Me.DeleteEntityList()
Am I missing a property setting to tell the "ReportReturnSum" to delete it's child ("ReportReturnHeader") records too?
Thanks.
-Bob S.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only