i have a datatable say DT having 11rows and i tried to delete rows having id=3 using
string DeptID ="3";
string s = "id='" + DeptID + "'";
rows = DT.Select(s);
foreach (DataRow r in rows)
r.Delete();
i am having 5 rows having id=3 but after deletion the number of rows in datatable not changed and some red color symbol comes in each fields(columns) of the deleted rows.Can anyone know why this is happening?
and whenever i tried to acces the remaining rows using
for(int i=0;i<dt1.Rows.Count;i++)
{
if (dt1.Rows[i][0].ToString() == "")
{
}
}
it shows error ‘deleted rows cannot take’
After deleting the rows,please give Acceptchanges() to the datatable,so that,it will get synchronized with new data.