以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]移动开发筛选问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=104072)

--  作者:狐作非为
--  发布时间:2017/7/22 15:53:00
--  [求助]移动开发筛选问题
    Case "filter.htm"
        wb.AddForm("","form1","list.htm")
        With wb.AddInputGroup("form1","ipg1","数据筛选")
            .AddInput("product","产品名称","string")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "submit")
        End With
    Case "list.htm"
        Dim flt As String
        If e.PostValues.ContainsKey("product") Then
            flt = "img01 = \'" & e.PostValues("product") & "\'"
        End If
        Dim cmd As new SQLCommand
        cmd.C
       \' cmd.CommandText= "S ELECT {img_file}.img01 as 产品编码, ima02 as 产品名称 ,{img_file}.img02 as 仓库编号,{img_file}.img03,{img_file}.img10 as 库存数量 FROM {img_file} INNER JOIN {ima_file} ON {img_file}.img01 = {ima_file}.ima01 ORDER BY img01"
        
cmd.CommandText= "S ELECT img01 as 产品编码,img02 as 仓库编号 ,img10 as 库存数量 from img_file"

        If flt > "" Then
            cmd.CommandText = cmd.CommandText & " where " & flt
        End If
        With wb.AddTable("","Table1")
            .CreateFromDataTable(cmd.ExecuteReader)
        End With
        With wb.AddButtonGroup("","btg1",True)
            .Add("btn1", "重新筛选", "","filter.htm")
        End With

红色字体的语句用不了,一用就报错

而下面一个command.text就可以用
[此贴子已经被作者于2017/7/22 15:53:34编辑过]

--  作者:有点蓝
--  发布时间:2017/7/22 16:01:00
--  
where不能放在order by后面,去掉前面的order by,放到后面


cmd.CommandText = cmd.CommandText & " where " & flt & " ORDER BY img01

--  作者:狐作非为
--  发布时间:2017/7/22 16:14:00
--  
改了,还是报错
在执行命令过程中,发生了一个或多个错误。
ORA-00933: SQL 命令未正确结束

--  作者:有点蓝
--  发布时间:2017/7/22 16:16:00
--  
学会调试:http://www.foxtable.com/webhelp/scr/1485.htm

messagebox.show(cmd.CommandText)看最终的sql是什么样的

--  作者:狐作非为
--  发布时间:2017/7/22 16:19:00
--  
不好意思,忘了去掉前面的order by