想要一个一个比较,相当一个笛卡尔积的量了.(我也不知c#是否提供了different(tab1,tab2)这种 东东.呵呵. a1表,a2表 比较次数 a1.count*a2.count for i=0 to a1.count for j=0 to a2.count if a1.fields1!=a2.fields1&&a1.fields?!=a2.fields? 在这里就将找到的放入一个datatable中去,如tabResult然后输出tabResult 简单说了下,没有用c#来写这段code
如DataTable1.Rows[i].Equals(DataTable2.Rows[i]),如果相同则得到true,否则false
public DataTable GetExcludeData(DataTable MasterDT,DataTable InvalidDT)
{
int nCols = MasterDT.Columns.Count;
//Define the Excluded Data
DataTable dtExclude = new DataTable();
dtExclude = MasterDT.Clone();
//Select the Invalid Data
foreach(DataRow dtrM in MasterDT.Rows)
{
for(int n=0; n<nCols; n++)
{
if(!MasterDT.Rows[n].Equals(InvalidDT.Rows[n]))
{
dtExclude.ImportRow(dtrM);
break;
}
}
}
return dtExclude;
}
Column1 Column2 Column3 Column4
11111 222222 3333333 4444444
22222 222222 3333333 4444444
33333 222222 3333333 4444444
44444 222222 3333333 4444444
55555 222222 3333333 4444444Table2
Column1 Column2 Column3 Column4
11111 222222 3333333 4444444
33333 222222 3333333 4444444
55555 222222 3333333 4444444
东东.呵呵.
a1表,a2表 比较次数 a1.count*a2.count
for i=0 to a1.count
for j=0 to a2.count
if a1.fields1!=a2.fields1&&a1.fields?!=a2.fields?
在这里就将找到的放入一个datatable中去,如tabResult然后输出tabResult
简单说了下,没有用c#来写这段code