老师,
您好!
我用以下代码做一个流水账表, 下面代码能正常计算
Select Case e.DataCol.Name
Case "收入","支出"
For Each dr As DataRow In e.DataTable.Select("[_SortKey] >= " & e.DataRow("_SortKey"))
Dim Val1 As Double = e.DataTable.Compute("Sum(收入)","[_SortKey] <= " & dr("_SortKey"))
Dim Val2 As Double = e.DataTable.Compute("Sum(支出)","[_SortKey] <= " & dr("_SortKey"))
dr("结余") = Val1 - Val2
Next
End Select
但数据太多, 我设定按条件加载行, 所有以改用以下代码, 但发现以下代码不执行任何计算, 请帮忙看下问题出来哪?
(数据源为Access)
Select Case e.DataCol.Name
Case "收入","支出"
For Each dr As DataRow In e.DataTable.Select("[_SortKey] >= " & e.DataRow("_SortKey"))
Dim Val1 As Double = e.DataTable.SQLCompute("Sum(收入)","[_SortKey] <= " & dr("_SortKey"))
Dim Val2 As Double = e.DataTable.SQLCompute("Sum(支出)","[_SortKey] <= " & dr("_SortKey"))
dr("结余") = Val1 - Val2
Next
End Select
[此贴子已经被作者于2021/2/9 15:50:05编辑过]