帮助看得不是很明白,比如下面这段代码,在做查询统计的时候,很多窗口按钮中会用到同样的代码,要怎么写成函数,然后又怎么调用
Dim jb1 As New SQLJoinTableBuilder("查询表1","订单2009")
jb1.ConnectionName = "Sale"
jb1.AddTable("订单","产品ID","产品","产品ID")
jb1.AddTable("订单", "客户ID","客户","客户ID")
jb1.AddCols("产品名称","客户名称","日期", "数量","单价")
jb1.AddExp("金额","数量 * 单价")
jb1.Filter = "客户名称 = '红阳事业'"
Dim jb2 As New SQLJoinTableBuilder("查询表1","订单2010")
jb2.ConnectionName = "Sale"
jb2.AddTable("订单","产品ID","产品","产品ID")
jb2.AddTable("订单", "客户ID","客户","客户ID")
jb2.AddCols("产品名称","客户名称","日期", "数量","单价")
jb2.AddExp("金额","数量 * 单价")
jb2.Filter = "客户名称 = '红阳事业'"
Dim jb3 As New SQLJoinTableBuilder("查询表1","订单2011")
jb3.ConnectionName = "Sale"
jb3.AddTable("订单","产品ID","产品","产品ID")
jb3.AddTable("订单", "客户ID","客户","客户ID")
jb3.AddCols("产品名称","客户名称","日期", "数量","单价")
jb3.AddExp("金额","数量 * 单价")
jb3.Filter = "客户名称 = '红阳事业'"
jb1.Union(jb2) '组合jb2
jb1.Union(jb3) '组合jb3
jb1.Build()