求助:
表B根据表A中的更新时间和指定时间之差,计算出了天数,然后表B对应增加天数,列出所有时间。
当表A中的时间列,怎么在新增时间值时候,判断时间值已经含有了某个时间,进而只新增没有的时间值。
假设表A中已含有
2014-12-01
2014-12-02
那么新增就从2014-12-03开始,之前的不要动
形成连贯数据
2014-12-01
2014-12-02
2014-12-03
基础代码如下:【请指导怎么写判断代码,下面的代码运行效果不理想】
Dim ab As Date =DataTables("表A").compute("Max(更新时间)")
Dim abc As Date ="2014-12-01"
Dim t As TimeSpan = ab - abc
Dim dr As DataRow
DataTables("表A").StopRedraw
For i As Integer = 0 To t.Days
dr = DataTables("表B").AddNew()
Dim str As Date = abc.AddDays(i)
Dim fdr As DataRow = DataTables("表B").Find("操作日期 = '" & Format(str, "yyy-MM-dd") & "'")
If fdr IsNot Nothing Then
msgbox("已存在")
e.Cancel = True
else
dr("操作日期") = Format(str, "yyy-MM-dd")
End If
Next
DataTables("表B").ResumeRedraw