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()
以上是实现 年|月|产品的加载树。
如何实现, 年|月|周