以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  目录树 周显示  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=162235)

--  作者:manyifuwu
--  发布时间:2021/4/9 17:47:00
--  目录树 周显示

1、窗口的AfterLoad事件代码改为:

Dim cmd As New S
Dim
dt As DataTable
cmd
.CommandText = "SEL  ECT DIST  INCT Year(日期) As , Month(日期) As , 产品 From {订单}"
dt
= cmd.ExecuteReader()
Dim
trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv
.BuildTree(dt, "年|月|产品")

2、目录树的NodeMouseDoubleClick事件代码改为:

Dim dr As DataRow = e.Node.DataRow \'获取生成此节点的行
Dim
Filter As String
Dim
Year As Integer = dr("年")
Dim
Month As Integer = dr("")
Dim
Product As String = dr("产品")
Select Case
e.Node.Level
    Case
0
       
Filter ="Year(日期) = " & Year
    Case
1
       
Filter ="Year(日期) = " & Year & " And Month(日期) = " & Month
    Case
2
       
Filter ="Year(日期) = " & Year & " And Month(日期) = " & Month & " And 产品 = \'" & Product & "\'"
End Select
DataTables(
"订单").LoadFilter = Filter
DataTables(
"订单").Load()

 

以上是实现  年|月|产品的加载树。

如何实现,   年|月|周


--  作者:有点蓝
--  发布时间:2021/4/10 8:40:00
--  
使用DatePart函数即可:http://www.foxtable.com/webhelp/topics/1827.htm