以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]外部SQL前提下针对表的数据生成目录树 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=64915) |
-- 作者:kwkvi -- 发布时间:2015/3/5 2:18:00 -- [求助]外部SQL前提下针对表的数据生成目录树 外部SQL前提下根据‘导航信息’表的数据生成目录树 打开程序时 不报错也不加载,窗口设计时点击应用又能正常加载 代码应该没有问题 内部数据版上正常 是我代码放的位置不对吗, 还是SQL数据库时 不能调用table 要调用datatable ? 导航窗口 afterload 代码 Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") Dim nd As WinForm.TreeNode Dim dt As DataTable = DataTables("导航信息") tr.StopRedraw() tr.Nodes.Clear tr.Nodes.Add("桌面") ‘设置返回主页面使用 For Each dr As DataRow In dt.Select("","编号") \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\' \'\'导航权限_显示 Dim a As String = dr("权限") Dim c() As String c = a.split(",") For Index As Integer = 0 To c.Length - 1 If c(Index)=_UserGroup Then If dr.IsNull("编号") = False AndAlso dr("编号").Length = 4 Then nd = tr.Nodes.Add(dr("编号"),dr("标题")) Functions.Execute("AddChildren",nd,dt) End If End If Next \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\' Next 要怎么修改? 另外弄的一个版本 同样问题 Dim trvf As WinForm.TreeView = e.Form.Controls("trv") trvf.GenerateTree("导航信息","路径","标题", ".", "权限 like \'" & _UserGroup & "\'") |
-- 作者:Bin -- 发布时间:2015/3/5 8:33:00 -- 可能是你 全局变量 _UserGroup 还没赋值, 你检查调试一下看看 |
-- 作者:有点甜 -- 发布时间:2015/3/5 9:08:00 -- 你的意思是不生成目录树?
For Each dr As DataRow In dt.Select("","编号")
改成
For Each dr As DataRow In dt.SqlSelect("","","编号") |
-- 作者:kwkvi -- 发布时间:2015/3/5 10:05:00 -- 附件传上来,帮忙看看,启动登陆后 应该是加载节点时出不来,在窗口设计时应用窗口时又能正常显示 找到问题了,内部函数惹的祸
[此贴子已经被作者于2015/3/6 2:32:50编辑过]
|
-- 作者:Bin -- 发布时间:2015/3/5 10:07:00 -- 看3楼试试看 |
-- 作者:有点甜 -- 发布时间:2015/3/5 10:10:00 -- Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\' |
-- 作者:kwkvi -- 发布时间:2015/3/5 10:43:00 -- Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") Dim nd As WinForm.TreeNode Dim dt As DataTable = DataTables("导航信息") tr.StopRedraw() tr.Nodes.Clear tr.Nodes.Add("桌面") For Each dr As DataRow In dt.sqlSelect("","", "编号") \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\' \'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\'\' \'导航权限_显示 Dim a As String = dr("权限") Dim c() As String c = a.split(",") For Index As Integer = 0 To c.Length - 1 If c(Index)=_UserGroup Then If dr.IsNull("编号") = False AndAlso dr("编号").Length = 4 Then nd = tr.Nodes.Add(dr("编号"),dr("标题")) Functions.Execute("AddChildren",nd,dt) End If End If Next Next 我把红色的隐藏了就正常了,这块改成外部SQL数据库怎么改
[此贴子已经被作者于2015/3/5 10:44:30编辑过]
|
-- 作者:有点甜 -- 发布时间:2015/3/5 10:47:00 -- 一样这样写啊,只要你的表结构一致,无论内部或外部数据库,都一样 |