.net - C# DataTable delete row -
i have datatable participantaccounts
not connected database or something.
how can delete row it?
this not working :
for (int = participantaccounts.rows.count - 1; >= 0; i--) { datarow dr= participantaccounts.rows[i]; if (equals(dr["sellrmembid"].tostring(), itemid)) participantaccounts.rows.removeat(i); } participantaccounts.acceptchanges();
it acts fine row still remains in datatable. tried dr.delete()
neither works. when try participantaccounts.rows.remove(dr)
exception the given datarow not in current datarowcollection.
what doing wrong?
if (participantaccounts.rows.contains(itemid)) { datarow foundrow = participantaccounts.rows.find(itemid); participantaccounts.rows.remove(foundrow); }
Comments
Post a Comment