以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]后台数据处理 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=160647) |
-- 作者:lxmoffice -- 发布时间:2021/2/9 15:19:00 -- [求助]后台数据处理 老师, 您好! 我用以下代码做一个流水账表, 下面代码能正常计算 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编辑过]
|
-- 作者:lxmoffice -- 发布时间:2021/2/9 22:17:00 -- 不好意思! 用以下方法已解决 http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&replyID=316905&ID=48879&skin=1
|