Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:加载及日期代码错误

1楼
weibu 发表于:2024/6/18 18:56:00
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()
2楼
有点蓝 发表于:2024/6/18 20:25:00
……
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
……
3楼
weibu 发表于:2024/6/19 8:55:00
老师我这样修改后,对应日期为1900-01-01的数据仍然加载不出来。而改为
  Filter = "outdepart in ('" & s.Replace("|", "','") & "') And rstype = '派货' And (checkdate >= '" & dt & "' Or checkdate = #01/01/1900#)" 
又报错“#附件有语法错误,我用的是SQLserver数据库

4楼
有点蓝 发表于:2024/6/19 9:00:00
http://www.foxtable.com/webhelp/topics/2343.htm
共4 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .03125 s, 2 queries.