以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]后台数据统计 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=185400) |
||||
-- 作者:瑞峰 -- 发布时间:2023/2/21 12:23:00 -- [求助]后台数据统计 上方标题不能自动变为实际值 代码在附件。 期待的效果 实际效果
[此贴子已经被作者于2023/2/21 12:39:00编辑过]
|
||||
-- 作者:瑞峰 -- 发布时间:2023/2/21 12:39:00 --
以下代码有什么问题? Dim t1 As Table = e.Form.Controls("Table1").Table Dim t2 As Table = e.Form.Controls("Table2").Table Dim Customer_ID1 As String = e.Form.Controls("Customer_ID1").value Dim Material_ID1 As String =e.Form.Controls("Material_ID1").value Dim Project_ID1 As String = e.Form.Controls("Project_ID1").value Dim DataType1 As String = e.Form.Controls("DataType1").value Dim CustGrp1 As String = e.Form.Controls("CustGrp1").value Dim ck As WinForm.CheckedComboBox = e.Form.Controls("Items") If ck.text = "" Then Return Dim sql As String = "SELE CT " & ck.Value & ",ltrim(str(year(Period))) + \'年\' + ltrim(str(month(Period))) + \'月\' [Version],Sum([Value]) As [Value] FROM wms_SaOP Group By " & ck.Value & ",ltrim(str(year(Period))) + \'年\' + ltrim(str(month(Period))) + \'月\' " Dim cmd As New SQLCommand cmd.C cmd.CommandText = sql Dim data As DataTable = cmd.ExecuteReader() Dim cols As String() = ck.Value.Split(",") If Cols.Length <= 0 Then Return Dim b As New CrossTableBuilder("统计表1",data ) For Each c As String In Cols b.HGroups.AddDef(c,t1.Cols(c).Caption) \'添加客户列用于水平分组 Next b.VGroups.AddDef("Version") \'添加产品列用于垂直分组 b.Totals.AddDef("Value") \'添加数量列用于统计 Dim dt As DataTable = b.Build(True) \'生成统计表 t2.DataSource = dt [此贴子已经被作者于2023/2/21 12:40:17编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2023/2/21 13:31:00 -- 请上传实例测试 |
||||
-- 作者:瑞峰 -- 发布时间:2023/2/21 14:16:00 -- 实例太多文件,有没有明显的错误 |
||||
-- 作者:有点蓝 -- 发布时间:2023/2/21 14:19:00 -- 看不出什么。新建一个项目,导出这个表和部分测试数据,做个同样窗口。把新项目发上来 |
||||
-- 作者:瑞峰 -- 发布时间:2023/2/21 15:00:00 -- 搞定了,是狐表BUG. |