在 http://www.foxtable.com/dispbbs.asp?boardid=2&Id=8837 中,狐爸你可以测试一下你4楼的代码 :
Dim t1 As Date = Date.Now
Dim dic As New Dictionary(of DataRow, DataRow)
Dim lst As New List(of Integer)
Dim drs As List(of DataRow)
Dim dr1 As DataRow
For Each dr1 In DataTables("表A").DataRows
drs = DataTables("表A").Select("[第二列] = " & dr1("第一列"),"_identify" )
' 注意:红字部分是加上的,绝不影响代码执行结果····效率差了20倍~
For Each dr2 As DataRow In drs
If lst.Contains(dr2("_Identify"))= False Then
lst.add(dr2("_Identify"))
dic.Add(dr1, dr2)
Exit For
End If
Next
Next
For Each dr As DataRow In dic.keys
dr1 = dic(dr)
dr("第八列") = dr1("_Identify")
dr("第九列") = dr1("第一列")
dr("第十列") = dr1("第二列")
Next
Output.Show("计算结束, 耗时: " & (Date.Now - t1).TotalSeconds & "秒")
[此贴子已经被作者于2010-12-15 19:32:56编辑过]