以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 统计加载问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=97962) |
-- 作者:HJG_HB950207 -- 发布时间:2017/3/21 21:10:00 -- 统计加载问题 总支下设支部,支部下设科室, 有表B1 列名如下:总支 支部 科室 姓名
用统计加载树 窗口 afterload 代码: Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "总支|支部|科室") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim A1 As String = nd.DataRow("总支") Dim B1 As String = nd.DataRow("支部") Dim C1 As String = nd.DataRow("科室") Select Case nd.Level Case 0 nd.Text = nd.text & "(" & dt.Compute("Sum(人数)","总支 = \'" & A1 & "\'") & "条)" Case 1 nd.Text = nd.text & "(" & dt.Compute( "Sum(人数)", "[支部] = \'" & B1 & "\'") & ")" Case 2 nd.Text = nd.text & "(" & nd.DataRow("人数") & ")" End Select Next trv.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(人数)") & "条)",0) trv.ResumeRedraw NODEMOUSEDOUBLECLICK 代码为: Dim Filter As String = "" If e.Node.Name <> "加载所有行" Then Dim A1 As String = e.Node.DataRow("总支") Dim B1 As String = e.Node.DataRow("支部") Dim C1 As String = e.Node.DataRow("科室") Select Case e.Node.Level Case 0 Filter ="总支 = " & A1 Case 1 Filter ="总支 = " & A1 & " And 支部 = " & B1 Case 2 Filter ="总支 = " & A1 & " And 支部 = " & B1 & " And 科室 = \'" & C1 & "\'" End Select End If DataTables("表B1").LoadFilter = Filter DataTables("表B1").Load() *运行结果为TREEVIEW正确,能在节点列出各总支、支部、科室合计数,但treeview 不能与表1互动。提示“至少一个参数没有被指定值” 烦请老师指教上代码如何修改。谢谢! |
-- 作者:有点蓝 -- 发布时间:2017/3/21 21:14:00 -- 加上单引号,其它地方自己改改 Filter ="总支 = \'" & A1 & "\' And 支部 = \'" & B1 & "\'"
|