提取数据
Dim cmd4 As New SQLCommand
Dim dt4 As DataTable
cmd4.CommandText = " Select {订单}.[_Identify], 客户名称,产品,数量,单价,地址,电话 From {订单} Inner JOIN {客户资料} ON {客户资料}.[客户代码] = {订单}.[客户]"
dt4 = cmd4.ExecuteReader()
Tables(e.Form.name & "_table1").DataSource =dt4
Tables(e.Form.name & "_table1").AutoSizeCols
生成统计表
Dim t As Table = Tables("窗口1_Table1")
Dim filter As String = ""
For Each r As Row In t.GetCheckedRows()
filter &= "," & r("_Identify")
Next
Dim b As New GroupTableBuilder("统计表1",t.DataTable)
b.Filter = "[_Identify] in (" & filter.Trim(",") & ")"
b.Groups.AddDef("产品") '根据产品分组
b.Groups.AddDef("客户名称")
b.Totals.AddDef("数量") '对数量进行统计
b.Totals.AddDef("单价")
b.Build '生成统计表
MainTable = Tables("统计表1") '打开生成的统计表