Foxtable(狐表)用户栏目专家坐堂 → [求助]提示sql语句执行错误


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

主题:[求助]提示sql语句执行错误

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/10/24 17:44:00 [只看该作者]

With e.Form.Controls("txtcp")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200),Product) like '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("txtgdh")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200),PNum) like '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("txtddh")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200), OrderNum) like '%" & .Value & "%'"
    End If
End With

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


加好友 发短信
等级:幼狐 帖子:92 积分:1778 威望:0 精华:0 注册:2014/4/11 21:10:00
  发帖心情 Post By:2018/10/24 22:38:00 [只看该作者]

有一个条件可以了,不报错。
但是下面这两个条件输入数据还是不行
With e.Form.Controls("txtcp")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200),Product) like '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("txtgdh")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200),PNum) like '%" & .Value & "%'"
    End If
End With


DataTables("工单资料").Fill("Select {PNumPrintInfo}.ID,{PNumPrintInfo}.PNum,{PNumPrintInfo}.Product,PartsName,MPStyle,PaperName,PrintScale,PrintColor,PrintColorDes,PCount,LCount,TotalCount,DevName,MScale,MPCount,Customer,ContractNum,InDate,OrderNum,Sales Fro m {PNumPrintInfo} Inner JOIN {PNumSumInfo} ON {PNumSumInfo}.[PNum] = {PNumPrintInfo}.[PNum] Where Filter Order By InDate desc", "xunyue", True)




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


加好友 发短信
等级:幼狐 帖子:92 积分:1778 威望:0 精华:0 注册:2014/4/11 21:10:00
  发帖心情 Post By:2018/10/24 22:53:00 [只看该作者]

解决了,改成这个
With e.Form.Controls("txtcp")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200),{PNumSumInfo}.Product) like '%" & .Value & "%'"
    End If
End With
With e.Form.Controls("txtgdh")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "convert(varchar(200),{PNumSumInfo}.PNum) like '%" & .Value & "%'"
    End If
End With


 回到顶部
总数 13 上一页 1 2