码生成日期周加载树后,单击日期周的过滤条件代码怎么写?
年的过滤条件:"Year(日期)=" & Year
月的过滤条件:"Month(日期)=" & Month
周的过滤条件:求助?
参考:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=192117
Dim week As integer = nd.DataRow("周")
Dim d As Date = New Date(year, 1, 1)
Dim w = d.DayOfWeek
Dim startdate As Date
Dim Enddate As Date
Select Case week
Case 0
startdate = d
Enddate = d.AddDays(7 - w - 1)
Case 53
startdate = d.AddDays(7 - w).AddDays(7 * 51)
Enddate = d.AddYears(1).AddDays( - 1)
Case Else
startdate = d.AddDays(7 - w).AddDays(7 * (week - 2))
Enddate = startdate.AddDays(6)
End Select
……
Case 2
Filter = "日期 >= #" & startdate & "# And 日期 <= #" & Enddate & "#"