Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parent-Child Delete?
Message
From
02/07/2008 09:03:00
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Parent-Child Delete?
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01328201
Message ID:
01328201
Views:
50
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
Map
View

Click here to load this message in the networking platform