有个窗口,里面有个统计外部数据库的临时表 有个统计按钮,一案会时不时的闪退窗口
按钮代码如下
DataTables("今日订单").Save()
Dim mx As WinForm.CheckBox = e.Form.Controls("CheckBox1")
Dim syzs As WinForm.CheckBox = e.Form.Controls("CheckBox2")
Dim yj As WinForm.CheckBox = e.Form.Controls("CheckBox3")
Dim ks As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim js As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Dim zs As WinForm.ComboBox = e.Form.Controls("ComboBox1")
If mx.Checked = False And syzs.Checked =False And zs.Value = "" Then
MessageBox.Show("分销名, 查看明细,所有分销至少选择一个")
Return
End If
Dim kssj As Date = ks.Value
Dim jssj As Date = js.Value
Dim g As New GroupTableBuilder("统计表1", DataTables("今日订单"))
If yj.Checked = False Then
Dim TIME As String="[录入时间] >= #"& kssj &"# And [录入时间] <= #"& JSSJ &"#"
Dim F As String
If ZS.Text="" Then
F = TIME
Else
F= "[录入时间] >= #"& kssj &"# And [录入时间] <= #"& JSSJ &"# AND [直属名] = '"& zs.text &"'"
g.Groups.AddDef("代理名")
End If
g.Filter =F
If syzs.Checked = True Then
g.Groups.AddDef("代理名")
End If
If mx.Checked = True Then
g.Groups.AddDef("表单名")
g.Totals.AddDef("数量")
End If
g.Totals.AddDef("分销金额")
g.Totals.AddDef("直属金额")
g.Totals.AddDef("邮费")
g.Totals.AddDef("订单数")
g.Totals.AddDef("返利")
g.FromServer = True
g.VerticalTotal = True '自动垂直汇总
g.Build()
Else
Dim TIME As String="[录入时间] >= #"& kssj &"# And [录入时间] <= #"& JSSJ &"#"
Dim F As String
If ZS.Text="" Then
F = TIME
Else
F= "[录入时间] >= #"& kssj &"# And [录入时间] <= #"& JSSJ &"# AND [直属名] = '"& zs.text &"'"
g.Groups.AddDef("代理名")
End If
g.Filter ="'"& F &"' and [是否算业绩]=True"
If syzs.Checked = True Then
g.Groups.AddDef("代理名")
End If
If mx.Checked = True Then
g.Groups.AddDef("表单名")
g.Totals.AddDef("数量")
End If
g.Totals.AddDef("直属金额","实际业绩")
g.Totals.AddDef("邮费")
g.Totals.AddDef("订单数")
g.Totals.AddDef("返利")
g.FromServer = True
g.VerticalTotal = True '自动垂直汇总
g.Build()
End If
Tables("统计_Table1").DataSource = g.BuildDataSource()
此主题相关图片如下:捕获.png