可以用在左右listbox的时候


private DataTable NoReDt(DataTable more, DataTable less)
{
DataTable dt3 = new DataTable();
dt3.Columns.Add("ID");
dt3.Columns.Add("Name");
dt3 =more .Copy ();
for (int j = 0; j < less.Rows.Count; j++)
{
foreach (DataRow moreDR in more.Rows)
{
if (less.Rows[j]["ID"].ToString() == moreDR["ID"].ToString ())
{
string strSQL = "ID='" + moreDR["ID"].ToString() + "'";
DataRow[] tmpDrs = dt3.Select(strSQL);
foreach (DataRow tmpDr in tmpDrs)
{
dt3.Rows.Remove(tmpDr);
}
break;
}
}
}
return dt3;
}