以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  目录树排序  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=127601)

--  作者:刘林
--  发布时间:2018/11/17 18:14:00
--  目录树排序
trv.BuildTree(dt,"考试名称|单位名称|年级代码|班级", "" ,"考试名称 desc")

我想将名称最近的排到前面,这样写出错呢,未将对象引用设置到对象的实例。

--  作者:有点甜
--  发布时间:2018/11/18 21:58:00
--  

 

实例发上来测试。

 


--  作者:刘林
--  发布时间:2018/11/18 22:02:00
--  
e.Form.BaseForm.windowstate = 2
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.c">If js.Contains("区业务主管")
    cmd.CommandText = "SELE    CT DISTINCT 考试名称,单位名称,年级代码,班级  From {成绩}  where 学段 =\'初中\'"
    Dim dt1 As DataTable = DataTables("考试名称")
    Dim cmb4 As WinForm.ComboBox = e.form.Controls("ComboBox1")
    cmb4.ComboList = dt1.GetComboListString("考试名称","学段=\'初中\'","考试名称 desc")
  Else
    cmd.CommandText = "SE    LECT DISTINCT 考试名称,单位名称,年级代码,班级,学段  From {成绩}  where 单位名称 = \'" & _usergroup & "\' and 学段 = \'初中\' and 考试名称 in (Se    lect 考试名称 From {考试名称} where 是否可看 = 1 and 学段=\'初中\')"
    Dim dt1 As DataTable = DataTables("考试名称")
    Dim cmb4 As WinForm.ComboBox = e.form.Controls("ComboBox1")
    cmb4.ComboList = dt1.GetComboListString("考试名称","学段=\'初中\' and 是否可看 = 1","考试名称 desc")
End If
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
\'trv.BuildTree(dt,"考试名称|单位名称|年级代码|班级", "" ,"考试名称 desc")
trv.BuildTree(dt,"考试名称|单位名称|年级代码|班级")

[此贴子已经被作者于2018/11/18 22:02:14编辑过]

--  作者:有点甜
--  发布时间:2018/11/19 0:31:00
--  
实例发上来测试。
--  作者:刘林
--  发布时间:2018/11/19 20:27:00
--  

此主题相关图片如下:qq图片20181119202636.png
按此在新窗口浏览图片

1、\'trv.BuildTree(dt,"考试名称|单位名称|年级代码|班级", "" ,"考试名称 desc")
2、trv.BuildTree(dt,"考试名称|单位名称|年级代码|班级")


用1出错
用2不出错,但我想将目录树按考试名称顺序倒过来排,即最近年份的排在前面,你看不用实例帮我看下如何实现



--  作者:有点蓝
--  发布时间:2018/11/19 20:37:00
--  
班级是整数列?改为字符列试试
--  作者:刘林
--  发布时间:2018/11/19 20:46:00
--  
都是字符列
--  作者:有点蓝
--  发布时间:2018/11/19 20:52:00
--  
代码看不出有什么问题。请上传实例测试