用以下代码可以较好解决问题,就是效率低了点。
老师,可以优化一下效率问题吗?
Case "编号"
If e.DataRow.Isnull("编号") = False
Dim dr As DataRow
dr = DataTables("表A").SQLFind("[编号] = '" & e.DataRow("编号") & "'")
If dr Is Nothing Then
dr = DataTables("表A").AddNew()
dr("编号") = e.DataRow("编号")
End If
End If
DataTables("表A").Save
DataTables("表B").Save
Case "姓名","性别","出生日期"
Dim dr As DataRow
dr = DataTables("表A").Find("[编号] = '" & e.DataRow("编号") & "'")
If dr IsNot Nothing Then
dr("姓名") = e.DataRow("姓名")
dr("性别") = e.DataRow("性别")
dr("出生日期") = e.DataRow("出生日期")
End If