HowTo Delete related rows

  • Thread starter Thread starter sjoshi
  • Start date Start date
S

sjoshi

Hello All

I have a DataSet with tables Customers, Orders related by CustomerID
coln. Now Orders has a field "FixIt", if this is set to true, I need to
delete that row.

The possible scenarios are:

1. Customer_1
Order_1 false
Order_2 true

2.Customer_1
Order_1 true
Order_2 true

So when it's case 1, I need to just delete the Order_2 from Orders.
However when its case 2, I need to delete all from Orders and
Customer_1.

What would be the best way to do this ?

thanks
Sunit
 
Very straightforward, you have to delete from the child table before
deleting from the parent table, i.e., delete your orders, then delete your
customers.
 
Back
Top