请问下下面代码中的属于返修检测的统计列为什么统计出来的结果不正确,大于实际的结果
DataTables("检测项目").LoadFilter = ""
DataTables("检测项目").Load
Dim lsb As DataTable = DataTables("检测项目")
Dim ryz() As String = {"A","B","C","D"}
Dim dtb As New DataTableBuilder("统计表")
dtb.AddDef("检测性质", Gettype(String), 32)
For Each ry As String In ryz
dtb.AddDef(ry, Gettype(Double), 32)
Next
dtb.AddDef("总计", Gettype(Double))
dtb.Build()
Dim rq As Date
With RibbonTabs("自定义1")("无损日统计表")
rq = .Items("rq").value
End With
Dim filter As String
Dim filter1 As String
Dim filter2 As String
If rq <> Nothing Then
filter &= " [首次检测_检测时间] = #" & rq & "#"
filter1 &= " [返修_返修时间] = #" & rq & "#"
filter2 &= " [二次返修_返修时间] = #" & rq & "#"
End If
Dim dr As DataRow = DataTables("统计表").AddNew()
Dim dr1 As DataRow = DataTables("统计表").AddNew()
Dim dr2 As DataRow = DataTables("统计表").AddNew()
Dim dr3 As DataRow = DataTables("统计表").AddNew()
For Each ry As String In ryz
dr("检测性质") = "首次检测"
dr(ry) = lsb.Compute("sum(检测人员_" & ry & ")", filter)
dr1("检测性质") = "返修检测"
dr1(ry) = lsb.Compute("sum(返修_" & ry & ")", filter1)
dr2("检测性质") = "二次返修检测"
dr2(ry) = lsb.Compute("sum(二次返修_" & ry & ")", filter2)
dr3("检测性质") = "合计:"
dr3(ry) = dr(ry) + dr1(ry) + dr2(ry)
Dim sum As Double
Dim sum1 As Double
Dim sum2 As Double
Dim sum3 As Double
sum = sum + dr(ry)
dr("总计") = sum
sum1 = sum1 + dr1(ry)
dr1("总计") = sum1 + dr1(ry)
sum2 = sum2 + dr2(ry)
dr2("总计") = sum2 + dr2(ry)
dr3("总计") = sum + sum1 + sum2
Next
filter = "1=1"
For Each ry As String In ryz
filter &= " and " & ry & " is null "
If DataTables("统计表").Compute("Sum(" & ry & ")") = 0 Then DataTables("统计表").DataCols.Delete(ry)
Next
'DataTables("统计表").DeleteFor(filter)
MainTable = Tables("统计表")