以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  聚合函数计算错误  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=148526)

--  作者:tld
--  发布时间:2020/4/9 15:16:00
--  聚合函数计算错误
老师,帮忙看看下面的代码哪里错误?计算结果为零,不正确

Dim name_fk As String = e.Form.Controls("ComboBox1").text

Dim t1 As Date = e.Form.Controls("DateTimePicker1").value

Dim t2 As Date = e.Form.Controls("DateTimePicker2").value

Dim filter1 As String = cexp("[付款单位]=\'0}\'and [日期] > \'{1}\' and  [日期] <= \'{2}\'",name_fk ,t1, t2)

Dim filter2 As String = cexp("[付款单位]=\'0}\'and [付款时间] > \'{1}\' and  [付款时间] <= \'{2}\'",name_fk ,t1, t2)

Dim zfy As Single = DataTables("流水").sqlCompute("sum(税后核定)", filter1)

Dim fk As Single = DataTables("付款流水").SQLCompute("sum(实付金额)", filter2)

e.Form.Controls("TextBox1").text = zfy - fk


t1 2005-01-01 00:00
t2 date.now
上面的代码计算结果是零。 实际不应该是零。

谢谢!

--  作者:有点蓝
--  发布时间:2020/4/9 15:26:00
--  
cexp("[付款单位]=\'{0}\' and