DataTable.Rows.RemoveAt() v/s BindingManagerBase.RemoveAt()

  • Thread starter Thread starter Aamir Ghanchi
  • Start date Start date
A

Aamir Ghanchi

The detail (children tables) rows don't get physically deleted in the
SQL server tables when using the RemoveAt() method of
DataRowCollection object. In fact it got deleted only with the
BindingManagerBase.RemoveAt() method

this.BindingContext[MyDataSetObject, strChildTable].RemoveAt(0);//
THIS WORKS

dsobjIDA.tblChild.Rows.RemoveAt(0);//THIS DOES NOT

I have the the relationship already setup in the Dataset.xsd file
between the master and children tables. MyDataSetObject includes both
master and related children tables

Amazed.

Aamir
 
Hi Miha,
There is no error, except that the detail table rows don't get
physically deleted in SQL server tables when using the RemoveAt()
method of
DataRowCollection object. Just wanted to share this with you all.
 
Hi Aamir,

This is the correct behaviour.
The rows are *removed* from collection which means the dataadapters won't
see them.
If you want to remove the row from database you should call DataRow.Delete()
which marks it as deleted.
 
Back
Top