左栏'); } else{ document.write('关闭左栏'); } }catch(e){alert(e);}
Foxtable(狐表)用户栏目专家坐堂 → 过滤条件增加代码


  共有1884人关注过本帖树形打印复制链接

主题:过滤条件增加代码

帅哥哟,离线,有人找我吗?
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106242 积分:540333 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/12/15 9:26:00 [显示全部帖子]

Dim dr As DataRow = DataTables("用户信息").find("用户名 = '" & 用户名 & "'")  '找到当前登录者所在的行
If dr IsNot Nothing Then
    Dim filter As String = "1=2"
    If dr("职位") = "管理者" Then
        Dim drs = DataTables("部门信息").Select("层级 like '" & dr("层级") & "%'")
        For Each cdr As DataRow In drs
            Filter &= " or 当前所在部门 = '" & cdr("所属部门") & "' And 是否可用 = 1 "
        Next
    Else If dr("职位") = "职员" Then
        Filter = "当前所在部门 = '" & dr("所属部门") & "' And 是否可用 = 1 "
    End If
    Dim Str1 As Integer = DataTables("溯源码").SQLCompute("Count(*)", filter)
    e.Form.Controls("Button26").Text ="当前库存: " & Str1
    Dim filter2 As String = filter & " And 过保日期 <= #" & Date.Today & "#"      这句代码是否有问题?我想在filter上增加筛选条件
    Dim Str2 As Integer = DataTables("溯源码").SQLCompute("Count(*)", filter2)
    e.Form.Controls("Button25").Text ="超保质期: " & Str2
End If

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106242 积分:540333 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/12/15 10:23:00 [显示全部帖子]

msgbox(filter2) 看看条件

如果是SqlServer数据库,#改为单引号

 回到顶部