metropia
asked on
Delete multiple rows in Entity Framework
Can someone help me showing me how to iterate through each child record using the parent key (coming from DataKey)
This is my code, so far I am able to firgure out how to get the children records (well the first one because there is no iteration):
Any help is kindly appreciated.
Thank you.
This is my code, so far I am able to firgure out how to get the children records (well the first one because there is no iteration):
Protected Sub DeleteAllChildren()
Dim myContext As New OLTPEntities
Dim myRecipeSteps = myContext.RefineRecipeStep.Where("it.Recipe_Id=" & Me.dvRecipeItem.DataKey(0)).First()
Dim strRecipeSteps = New StringBuilder("")
strRecipeSteps.Append("[ID]=" & myRecipeSteps.Id & ", ")
strRecipeSteps.Append("[Recipe_Id]=" & myRecipeSteps.Recipe_Id & ", ")
strRecipeSteps.Append("[Recipe_ItemNumber]=" & myRecipeSteps.Recipe_ItemNumber & ", ")
strRecipeSteps.Append("[Recipe_VersionNumber]=" & myRecipeSteps.Recipe_VersionNumber & ", ")
strRecipeSteps.Append("[ProcessType]=" & myRecipeSteps.ProcessType & ", ")
strRecipeSteps.Append("[AdditionOrder]=" & myRecipeSteps.AdditionOrder & ", ")
strRecipeSteps.Append("[IngredientItemNumber]=" & myRecipeSteps.IngredientItemNumber & ", ")
strRecipeSteps.Append("[AdditionType]=" & myRecipeSteps.AdditionType & ", ")
strRecipeSteps.Append("[RecipePercent]=" & myRecipeSteps.RecipePercent)
End Sub
Any help is kindly appreciated.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.