HowTo Delete related rows

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
 
E

Earl

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top