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 ())
{< br> 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 -- )
{< br> int index = convert. toint32 (dellist [k]);
table. rows. removeat (INDEX);
}
Table. acceptchanges ();
When binding data to a DataGrid, You need to judge the data and remove the data that does not meet the conditions from the datatable.
CodeAs follows: