Dim v1 As New List(of String)
v1.AddRange(DataTables("表A").GetComboListString("日期","","日期").split("|"))
Dim sql,s1 As String
For n1 As Integer =1 To v1.count
SQL+=" ,Max(考勤) As A" & n1
Next
SQL="Select 姓名" & SQL & " From{表A} Group by 姓名"
Dim dtb As New DataTableBuilder("统计")
dtb.Build()
With DataTables("统计")
.StopRedraw
.Fill(SQL,True)
For Each c As Col In Tables("统计").Cols
If c.Index > 0 Then
.DataCols(c.name).Caption = Format(Cdate(v1(c.Index -1)),"yyyy-MM-dd")
.BuildHeader()
End If
Next
For Each r As Row In Tables("统计").Rows
For Each c As Col In Tables("统计").Cols
If c.Index > 0 Then
r(c.name) = DataTables("表A").Find("姓名 = '" & r("姓名") & "' And 日期 =#" & c.Caption & "#")("考勤")
End If
Next
Next
MainTable= Tables("统计")
.ResumeRedraw
End With