计算每个客户的订购数量:
Dim dt As DataTable = DataTables("订单")
Dim
Total As
Integer
Dim
Customers As
List(Of
String)
Customers =
dt.GetValues("客户")
For
Each Customer As String In Customers
Total = dt.Compute("Sum(数量)", "[客户] = '"
&
Customer
&
"'")
Output.Show(Customer
&
":"
&
Total)
Next
上述代码中,Filter参数分成了三部分,各部分用运算符&连接起来:
"[客户] = '"
& Customer & "'"
如果客户名称为CS01,那么三部分组合后,Filter参数就等于:
"[客户] = 'CS01'"
以上为帮助文件
我的理解就是以下写法, 实在想不通了这个为什么不对 发贴求助。。。
Total = dt.Compute("Sum(数量)", "[客户] = 'Customer'")