Dim dt1 As DataTable = DataTables("表B")Dim dt2 As DataTable = DataTables("合并村")'dt1.StopRedrawFor Each dr As DataRow In dt1.Select("") Dim str As String = dr("家庭住址") str = str.Replace("1", "一").Replace("2", "二") For Each fdr As DataRow In dt2.Select("") Application.Doevents If fdr("合并前村") > "" AndAlso str.Contains(fdr("合并前村")) Then dr("合并前村") = fdr("合并前村") dr("合并后村") = fdr("合并后村") End If Next Next'dt1.ResumeRedraw
增加一个条件表B更新数据前要求表B的乡镇字段合并村的乡镇字段一致才更新