Dim cmd As New SQLCommand
cmd.C
Dim dt As DataTable
cmd.CommandText = "SELECT DISTINCT Year(消费日期) As 年, Month(消费日期) As 月, 品牌, 店铺 From {会员消费表} "
dt = cmd.ExecuteReader()
Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1")
tv.BuildTree(dt, "年|月")
tv.Nodes.Insert("显示所有行",0)
Dim str1 As String = dt.GetComboListString("品牌")
Dim str2 As String = dt.GetComboListString("店铺")
tv.Nodes.Add("品牌")
tv.Nodes.Add("店铺")
For Each s As String In str1.Split("|")
tv.Nodes("品牌").Nodes.Add(s)
Next
For Each s As String In str2.Split("|")
tv.Nodes("店铺").Nodes.Add(s)
Next
[此贴子已经被作者于2014-3-18 17:32:45编辑过]