以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  语句请教  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=72844)

--  作者:cuicuibing
--  发布时间:2015/8/7 14:22:00
--  语句请教
Dim Filter As String
With e.Form.Controls("DropBox1")
    If .Value IsNot Nothing Then
        Filter = "内部加工单号  in (\'" & .Value.replace(",","\',\'") & "\')"
    End If
End With
With e.Form.Controls("combobox1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "工段 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("DropBox3")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "产品名称 = \'" & .Value & "\'"
    End If
End With
If Filter > "" Then
    DataTables("工序库调用_Table1").LoadFilter = Filter \'设置加载条件
    DataTables("工序库调用_Table1").Load()
End If
Dim cmd1 As New SQLCommand
Dim dt As DataTable
cmd1.C
cmd1.CommandText = "SE LECT * From {派工明细表} Where filter" 这里的语句应该怎么写。
dt = cmd1.ExecuteReader()

红色部分where 后边的如何写。用了集中办法都不行。是不是上边的这句 Filter = "内部加工单号  in (\'" & .Value.replace(",","\',\'") & "\')" 定义不行。


--  作者:大红袍
--  发布时间:2015/8/7 14:25:00
--  

 

cmd1.CommandText = "SE LECT * From {派工明细表} " & iif(Filter>"", "Where " & filter, "")