Fran Parker
MaxQ Technologies, Inc.
Public Function DeleteChildrenRecords(Byval ParentPrimaryKey As Integer) As Integer Dim loCommand As New SQLCommand
'-- Create the command loCommand.CommandText = "DELETE FROM MyTable WHERE MyField_ParentPK = @MyField_ParentPK"
'-- Create the parms loCommand.Parameters.Add("@MyField_ParentPK", SqlDbType.Int) '-- Set the parms loCommand.Parameters("@MyField_ParentPK").Value = ParentPrimaryKey '-- Return the number of records deleted Return Me.ExecuteNonQuery(loCommand)End Function
So in the BeforeDelete or AfterDelete event of the BO on the form, call the method above:
MyChildBO.DeleteChildrenRecords(Me.MyPrimaryKey)