Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
Parent-Child Delete?
Versions des environnements
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.
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement