以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [讨论]筛选  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=76684)

--  作者:yupeng
--  发布时间:2015/11/3 14:50:00
--  [讨论]筛选

 


图片点击可在新窗口打开查看此主题相关图片如下:11.jpg
图片点击可在新窗口打开查看

 

当我选择图片里面的三项是出现运行错误“#”附近有语法错误,选择其它任何条件都可以

 

以下是代码,请大师帮我看一下。谢谢

 

Dim nms() As String = {"客户","品牌","款号","PO号","加工厂","日期起","日期止"}
Dim sps() As String = {"\'","\'","\'","\'","\'","#","#"}
Dim bjf() As String = {" = "," = "," = "," = "," = "," >= "," <= "}
Dim fds() As String = {"客户","品牌","款号","PO号","加工厂_工厂","订单交期","订单交期"}
Dim Filter As String
For i As Integer = 0 To nms.length -1
    If e.Form.Controls(nms(i)).Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & fds(i) & bjf(i) & sps(i) & e.Form.Controls(nms(i)).Value & sps(i)
    End If
Next
\' ===========以下是生产状态============
Dim scs() As String = {"车间A组","车间B组","车间C组","外发生产","外发工艺"}
For Each sc As String In scs
    If e.Form.Controls("车间A组").Checked = True \' 如果付款状态选择了"车间A组"
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_工厂 = \'车间A组\'"
    End If
   
    If e.Form.Controls("车间B组").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_工厂 = \'车间B组\'"
    End If
   
    If e.Form.Controls("车间C组").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_工厂 = \'车间C组\'"
    End If
   
    If e.Form.Controls("外发生产").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "加工厂_负责人 is not null"
    End If
   
    If e.Form.Controls("外发工艺").Checked = True
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "特殊工艺_名称 <> \'无\'"
    End If
Next
\'  ===========以上是生产状态============

 

 

\'\'  ============以下是订单状态=============
Dim sys() As String = {"生产中订单","已注销订单","全部订单"}
For Each sy As String In scs
   
    Dim scz As WinForm.RadioButton = e.Form.Controls("生产中订单")  \' 如果选择了生产中的订单
    If scz.checked = True Then  \'判断有没有选中
        DataTables("生产进度表").LoadFilter = "注销 = 0"  \'选中执行加载生产进度表的注销为false
    End If
   
    Dim yjx As WinForm.RadioButton = e.Form.Controls("已注销订单")
    If yjx.checked = True Then
        DataTables("生产进度表").LoadFilter = "注销 = 1"
    End If
   
    Dim qian As WinForm.RadioButton = e.Form.Controls("全部订单")
    If qian.checked = True Then
        DataTables("生产进度表").LoadFilter = Filter
    End If
Next

DataTables("生产进度表").Load
\' ============以上是订单状态=============
Tables("生产进度表").Filter = Filter


 


--  作者:大红袍
--  发布时间:2015/11/3 15:04:00
--  

msgbox看一下弹出什么。

 

如果你的是sqlserver数据库,要把#改成单引号\'才行


--  作者:yupeng
--  发布时间:2015/11/3 15:28:00
--  
谢谢您   把#改掉就行了