Dim cmd As New SQLCommand Dim dt AsDataTable cmd.CommandText = "Select Distinct Year(日期) As 年, Month(日期) As 月, 产品 From {订单} where" & tvnow dt = cmd.ExecuteReader() Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "年|月|产品") trv.Nodes.Insert("显示所有行",0)