用来删除表中第二列 ,第三列都一样的重复多余行,只保留一行
问题是:
1.当第二列和第三列类型都为字符型时可以实现目的
2.当第二列或第三列为整数型时出错
此主题相关图片如下:123.png

请版主赐教
Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第二列,第三列"
For Each dr As DataRow In DataTables("dsjzl").Select("", cs)
Dim flag As Boolean = False
If pdr IsNot Nothing Then
For Each c As String In cs.split(",")
If pdr(c).replace(" ", "") <> dr(c).replace(" ", "") Then
flag = True
Exit For
End If
Next
If flag Then
If count > 1 Then
idx &= idx_temp
End If
count = 1
idx_temp = ""
Else
count += 1
idx_temp &= dr("_Identify") & ","
End If
Else
count += 1
End If
pdr = dr
Next
If count > 1 Then
idx &= idx_temp
End If
Tables("dsjzl").Filter = "_Identify not In (" & idx.trim(",") & ")"
'DataTables("dsjzl").DeleteFor("_Identify not In (" & idx.trim(",") & ")")