参考代码
Dim dt1 As DataTable = DataTables("客户表")
Dim dt2 As DataTable = DataTables("行政区域")
If dt1.DataCols.Contains("省") = False Then
dt1.datacols.Add("省", Gettype(String))
dt1.datacols.Add("市", Gettype(String))
End If
Dim i As Integer = 0
'dt1.StopRedraw
For Each dr As DataRow In dt1.Select("")
For Each fdr As DataRow In dt2.DataRows
Application.Doevents
Dim str = dr("青岛锚链股份有限公司")
If str.contains(fdr("省市")) Then
dr("省") = fdr("省市")
ElseIf fdr("省市").length >= 3 AndAlso str.contains(fdr("省市").replace("省", "").replace("市", "").replace("自治区", ""))
dr("省") = fdr("省市")
End If
If str.contains(fdr("县市")) Then
dr("市") = fdr("县市")
ElseIf fdr("县市").length >= 3 AndAlso str.contains(fdr("县市").replace("县", "").replace("市", ""))
dr("市") = fdr("县市")
End If
Next
i += 1
output.show(i)
Next
'dt1.ResumeRedraw