DataTable table = GetTable();
int count = table.Rows .Count;
ArrayList delList = new ArrayList ();
for(int m=0;m<count ;m++ )
{
DataRow dr = table.Rows[m];
string[] processdep = dr["ProcessingDep"].ToString ().Split (',');
int Flag =0;
string dd = dr["Processing"].ToString ();
int d= dr["Processing"].ToString ().IndexOf (DepartmentName);
for(int j=0;j<processdep.Length ;j++)
{
if(processdep[j]==depId.ToString ())
{
Flag=1;
break;
}
}
if(Flag==0)
{
delList.Add (m);
}
else
if(dr["Processing"].ToString ().IndexOf (DepartmentName)>=0)
{
delList.Add (m);
}
}
for(int k=delList.Count-1;k>=0 ;k--)
{
int index = Convert.ToInt32 (delList[k]);
table.Rows.RemoveAt (index);
}
table.AcceptChanges ();
代码如下