我想实现显示全部数据,但是系统提示如截图
With e.form.Controls("combobox1")
If .Value = "按园区查询" Then
Dim cmd1 As New SQLCommand
Dim dt1 As DataTable
cmd1.ConnectionName = "种植数据管理"
cmd1.CommandText = "Select Distinct Year(归档时间) As 年, Month(归档时间) As 月, 所建园区名称 F rom {建园文件}"
dt1 = cmd1.ExecuteReader()
Dim trv1 As WinForm.TreeView = e.form.Controls("TreeView1")
trv1.BuildTree(dt1, "年|月|所建园区名称")
trv1.Nodes.Insert("显示全部园区",0)
ElseIf .value = "按文件类型查询" Then
Dim cmd2 As New SQLCommand
Dim dt2 As DataTable
cmd2.ConnectionName = "种植数据管理"
cmd2.CommandText = "Select Distinct Year(归档时间) As 年, Month(归档时间) As 月, 文件类型 F rom {建园文件}"
dt2 = cmd2.ExecuteReader()
Dim trv2 As WinForm.TreeView = forms("建园文件").Controls("TreeView1")
trv2.BuildTree(dt2, "年|月|文件类型")
trv2.Nodes.Insert("显示全部文件类型",0)
ElseIf .value ="按文件种类查询"
Dim cmd3 As New SQLCommand
Dim dt3 As DataTable
cmd3.ConnectionName = "种植数据管理"
cmd3.CommandText = "Select Distinct Year(归档时间) As 年, Month(归档时间) As 月, 所属文件种类 F rom {建园文件}"
dt3 = cmd3.ExecuteReader()
Dim trv3 As WinForm.TreeView = forms("建园文件").Controls("TreeView1")
trv3.BuildTree(dt3, "年|月|所属文件种类")
trv3.Nodes.Insert("显示全部文件种类",0)
ElseIf .value ="按文件来源查询"
Dim cmd4 As New SQLCommand
Dim dt4 As DataTable
cmd4.ConnectionName = "种植数据管理"
cmd4.CommandText = "Select Distinct Year(归档时间) As 年, Month(归档时间) As 月, 文件来源 F rom {建园文件}"
dt4 = cmd4.ExecuteReader()
Dim trv4 As WinForm.TreeView = f orms("建园文件").Controls("TreeView1")
trv4.BuildTree(dt4, "年|月|文件来源")
trv4.Nodes.Insert("显示全部文件来源",0)
End If
If .value Is Nothing Then
messagebox.show("请选择查询方式")
End If
End With
此主题相关图片如下:qq截图20150308164333.png