以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- 请看一下公式那里有错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=22627)
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 19:46:00
-- 请看一下公式那里有错
Dim tr As winform.treeview Dim nd1 As winform.treenode Dim nd2 As winform.treenode tr = e.Form.controls("treeview1") Dim cmd As new sqlcommand Dim dt,dt2 As DataTable cmd.CommandText = "SELECT DISTINCT 产品,客户 From {订单}" dt = cmd.ExecuteReader() dt2 = dt nd1 = tr.nodes.add("a1","按产品") For Each dr As DataRow In dt.DataRows nd1 = tr.nodes.add("0101",dr("产品")) Next nd1 = tr.nodes.add("a2","按客户") For Each dr As DataRow In dt.DataRows nd1 = tr.nodes.add("0101",dr("客户")) Next tr.expandall()
根据以上公式在订单表中可以生成目录树,但没有卷展,应该怎么改
|
-- 作者:czy
-- 发布时间:2012/8/19 19:55:00
--
For Each dr As DataRow In dt.DataRows nd1.nodes.add("0101",dr("产品")) Next
|
-- 作者:czy
-- 发布时间:2012/8/19 19:59:00
--
但我觉得上面的代码应该改成这样
Dim Values() As String = dt.GetComboListString("产品").split("|") For i As Integer = 0 To Values.Length - 1 nd1.nodes.add("0101",Values(i)) Next
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 20:00:00
--
谢谢
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 20:08:00
--
应该加在那里,提示有错啊
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 20:11:00
--
出现如图错误,另外客户名也是重复的啊 此主题相关图片如下:未命名.jpg
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 20:12:00
--
此主题相关图片如下:未命名1.jpg
|
-- 作者:czy
-- 发布时间:2012/8/19 20:24:00
--
Dim tr As winform.treeview Dim nd1 As winform.treenode Dim nd2 As winform.treenode tr = e.Form.controls("treeview1") Dim cmd As new sqlcommand Dim dt,dt2 As DataTable cmd.CommandText = "SELECT DISTINCT 产品,客户 From {订单}" dt = cmd.ExecuteReader() dt2 = dt nd1 = tr.nodes.add("a1","按产品")
Dim Values() As String = dt.GetComboListString("产品").split("|") For i As Integer = 0 To Values.Length - 1 nd1.nodes.add("0101",Values(i)) Next
……
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 20:35:00
--
Dim tr As winform.treeview Dim nd1 As winform.treenode Dim nd2 As winform.treenode tr = e.Form.controls("treeview1") Dim cmd As new sqlcommand Dim dt,dt2 As DataTable cmd.CommandText = "SELECT DISTINCT 产品,客户 From {订单}" dt = cmd.ExecuteReader() dt2 = dt nd1 = tr.nodes.add("a1","按产品") Dim Values() As String = dt.GetComboListString("产品").split("|") For i As Integer = 0 To Values.Length - 1 nd1.nodes.add("0101",Values(i)) Next nd1 = tr.nodes.add("a1","按客户") Dim Values() As String = dt.GetComboListString("客户").split("|") For i As Integer = 0 To Values.Length - 1 nd1.nodes.add("0101",Values(i)) Next
tr.expandall()
按客户怎么不行了
|
-- 作者:gslxzy
-- 发布时间:2012/8/19 20:41:00
--
好了,谢谢
|