正确的代码:
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("表A"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("ID")
bd1.Totals.AddDef("数1")
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("表B"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("ID")
bd2.Totals.AddDef("数2")
dt2 = bd2.BuildDataSource()
dt1.Combine("id",dt2,"id") '将销售统计数据组合到进货统计数据
dt1.Show("统计表1")
DataTables("统计表1").DataCols.Add("合计",Gettype(Double),"数1 + 数2")
参考:
http://www.foxtable.com/help/topics/2305.htm