关于筛选树的问题,下面的代码都是仿帮助的,但执行的时候会有错误提示,帮忙看下是什么问题,谢谢
AfterLoad
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.CommandText = "SELECT DISTINCT Year(月份营运报表_日期) As 年, Month(月份营运报表_日期) As 月, 服务执行单据记录表_客户站点 From {综管}"
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "年|月|服务执行单据记录表_客户站点")
NodeMouseDoubleClick
Dim Value()As String
Dim Filter As String
Dim d1 As Date
Dim d2 As Date
Value = e.Node.FullPath.Split("\")
Select Case e.Node.Level
Case 0
Dim y As Integer = value(0)
d1 = New Date(y,1,1) '取得该年的第一天
d2 = new Date(y,12,31) '取得该年的最后一天
Filter = "月份营运报表_日期 >= #" & d1 & "# And 月份营运报表_日期 <= #" & d2 & "#"
Case 1
Dim y As Integer = value(0)
Dim m As Integer = value(1)
d1 = New Date(y, m, 1) '取得该月的第一天
d2 = new Date(y, m, Date.DaysInMonth(y,m)) '取得该月的最后一天
Filter = "月份营运报表_日期 >= #" & d1 & "# And 月份营运报表_日期 <= #" & d2 & "#"
Case 2
Dim y As Integer = value(0)
Dim m As Integer = value(1)
d1 = New Date(y, m, 1) '取得该月的第一天
d2 = new Date(y, m, Date.DaysInMonth(y,m)) '取得该月的最后一天
Filter = "月份营运报表_日期 >= #" & d1 & "# And 月份营运报表_日期 <= #" & d2 & "# And 服务执行单据记录表_客户站点 = '" & Value(2) & "'"
End Select
Tables("综管").Filter = Filter
错误提示:
此主题相关图片如下:未命名1.jpg
此主题相关图片如下:未命名2.jpg