How to remove certain rows from dataset table

M

Mika M

Hello,

I think this is quite newbie question...

I have DataSet with tables "Parent" and "Child", and relation one to many
between these tables. How can I remove rows from Child -table where for
example ParentID = 5, and leaving Parent tables parent row as is ? How to do
this using code.

Propably ds.Tables("Child"). ... ?
 
M

Miha Markic

You might do the following:
foreach (DataRow row in
ds.Tables("Parent").Rows(yourrowindexhere).GetChildRows("relationnamehere"))
row.Delete();
 

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