MainTable = Tables("rs_indepot")
Dim dt As Date = Date.Today.AddDays(-450)
Dim dr As DataRow = DataTables("rs_userinfo").find("sname = '" & rsuser & "'") '找到当前登录者所在的行
Dim filter As String = "1=2"
If dr("position") = "管理者" Then
Dim drs = DataTables("rs_departinfo").Select("departno like '" & dr("departno") & "%'")
For Each cdr As DataRow In drs
Filter &= " or outdepart = '" & cdr("depart") & "'And rstype = '派货'And checkdate >= '" & dt & "'Or checkdate = #01/01/1900#" ‘老师这段代码是不是有问题?
Next
Else If dr("position") = "职员" Then
Filter = "outdepart = '" & dr("indepart") & "'And rstype = '派货'And checkdate >= '" & dt & "'Or checkdate = #01/01/1900#"
End If
DataTables("rs_indepot").LoadTop = "1000"
DataTables("rs_indepot").LoadOrder = "checkdate DESC"
Tables("rs_indepot").OpenLoadTree("outdepart|checkdate YM|ordercode|proname",200,1000,True,Filter) ’我为了让数据加载更改高效,在Filter中添加只加载450天内的数据,请问这让是有帮助吗? 我想确认生成加载树并加载数据,添加450天内是否对加载树生成和加载数据效率有提升?
Tables("rs_indepot").Sort = "checkdate DESC"
Forms("派货出库汇总").Open()
……Dim filter As String
If dr("position") = "管理者" Then
Dim s As String = DataTables("rs_departinfo").GetComboListString("depart", "departno like '" & dr("departno") & "%'")
Filter = "outdepart in ('" & s.Replace("|", "','") & "') And rstype = '派货' And (checkdate >= '" & dt & "' Or checkdate is null)"
Else If dr("position") = "职员" Then
Filter = "outdepart = '" & dr("indepart") & "'And rstype = '派货' And (checkdate >= '" & dt & "' Or checkdate is null)"
End If
……
老师我这样修改后,对应日期为1900-01-01的数据仍然加载不出来。而改为 Filter = "outdepart in ('" & s.Replace("|", "','") & "') And rstype = '派货' And (checkdate >= '" & dt & "' Or checkdate = #01/01/1900#)"
又报错“#附件有语法错误,我用的是SQLserver数据库