Foxtable(狐表)用户栏目专家坐堂 → 数据表数据生成导多航目录树问题


  共有3087人关注过本帖树形打印复制链接

主题:数据表数据生成导多航目录树问题

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/10 11:39:00 [显示全部帖子]

代码

 

Dim cmd As new SQLCommand
cmd.CommandText = "select '按分组' as 分组, 省, 市, 区县, 乡镇, 街道居委会 from {客户分组} where 省 is not null"
cmd.CommandText &= " union select '按等级', 客户等级, null, null, null, null from {客户等级} where 客户等级 is not null"
Dim dt As DataTable = cmd.ExecuteReader
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "分组|省|市|区县|乡镇|街道居委会")


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/10 14:14:00 [显示全部帖子]

 例子测试可以的。

 

Dim cmd As new SQLCommand
cmd.ConnectionName = "数据源名字"
cmd.CommandText = "select '按分组' as 分组, 省, 市, 区县, 乡镇, 街道居委会 from {客户分组} where 省 is not null"
cmd.CommandText &= " union select '按等级', 客户等级, null, null, null, null from {客户等级} where 客户等级 is not null"
Dim dt As DataTable = cmd.ExecuteReader
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "分组|省|市|区县|乡镇|街道居委会")


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/10 15:59:00 [显示全部帖子]

你的个人客户信息表,没有客户等级列

 

具体问题,请上传例子。


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/9/11 9:18:00 [显示全部帖子]

Dim cmd1 As new SQLCommand
cmd1.ConnectionName = "数据源名字"
cmd1.CommandText = "select '按分组' as 分组, 营业区, 营业部, 营业组 from {成员分组} where 营业区 is not null"
cmd1.CommandText &= " union select '按职级', 职级, null, null from {职级} where 职级 is not null"
cmd1.CommandText &= " union select '按来源', 来源, null, null from {等级} where 来源 is not null"
cmd1.CommandText &= " union select '按学历', 学历, null, null from {学历} where 学历 is not null"
cmd1.CommandText &= " union select '按类型', 成员类型, null, null  from {成员类型} where 成员类型 is not null"
Dim dt1 As DataTable = cmd1.ExecuteReader
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView3")
trv2.BuildTree(dt1, "分组|营业区|营业部|营业组")

 回到顶部