1
Answer

DataTable delete row

Ilkin Turk

Ilkin Turk

11y
1.1k
1
Hello When I try to delete row from datatable get error : Collection was modified; enumeration operation might not execute.

My code is below :
foreach (DataRow dr in dt.Rows)
            {
                if(dr["Name"]=="")
                {
                    dr.Delete();
                    
                }
                    dtr.AcceptChanges();
            }
If any idea give please.Or may be there are another way.

Answers (1)