Dim dt1 As Date = #11/14/2016# Dim dt2 As Date = #11/14/2016# Dim dtb As New DataTableBuilder("统计表1") dtb.AddDef("name", Gettype(String), 32) dtb.AddDef("cardno", Gettype(String), 32) dtb.AddDef("date", Gettype(Date)) dtb.AddDef("t1", Gettype(String)) dtb.AddDef("t2", Gettype(String)) dtb.Build For Each dr1 As DataRow In DataTables("AtdRecord88").DataRows For i As Integer = 0 To (dt2 - dt1).TotalDays Dim dr2 As DataRow = DataTables("统计表1").find("CardNo = '" & dr1("CardNo") & "'And date >= #" & dr1("time") & "# And date < #" & dr1("time").AddDays(1) & "# ") If dr2 IsNot Nothing Then dr2 = DataTables("统计表1").Addnew dr2("name") = dr1("recName") dr2("CardNo") = dr1("CardNo") dr2("date") = dt1.AddDays(i) Dim drs As List(of DataRow) = DataTables("AtdRecord88").Select("CardNo = '" & dr2("CardNo") & "'And Time >= #" & dr2("Date") & "# And Time < #" & dr2("Date").AddDays(1) & "# ") For n As Integer = 0 To drs.count -1 Dim t As String = Format(drs(n)("Time"),"HH:mm") If t <= "12:00" Then dr2("t1") = t Else dr2("t2") = t End If Exit For Next End If Next Next
|