With Tables("表A").Current
If .Isnull("编号") = False OrElse .IsNull("日期") = False Then
MessageBox.Show("缺少 编号 或日期!")
Return
End If
End With
Dim dr As DataRow = DataTables("表B").find("编号 = '" & Tables("表A").Current("编号") & "'")
If dr IsNot Nothing Then
If dr("日期") > cdate(Tables("表A").Current("编号")).AddDays(1) Then
Dim Result As DialogResult
Result = MessageBox.Show("是否替换?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = DialogResult.Yes Then
dr("日期") = cdate(Tables("表A").Current("编号")).AddDays(1)
End If
Else
dr("日期") = cdate(Tables("表A").Current("编号")).AddDays(1)
End If
End If