以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]WEB查询问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=98811)

--  作者:aduydgd
--  发布时间:2017/4/7 13:06:00
--  [求助]WEB查询问题
S elect Cas e e.Path
    Case "bjkc.htm"
        wb.AddForm("","form1","bjkc.htm")
        With wb.AddInputGroup("form1","ipg1","库存查询")
            .AddInput("bjmc","备件名称:","text")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "查询", "submit")
        End With
        Dim cmd1 As New SQLCommand
        cmd1.C 
        cmd1.CommandText = "SE L ECT ID AS 物料ID,JIGOU AS 所属机构,CANGKU AS 所属仓库,MINGCHENG AS 物料名称,SHULIANG AS 库存数量 F R OM KUCUN"
        Dim dt1 As DataTable = cmd1.ExecuteReader    
        With wb.AddTable("","Table1")
            .CreateFromDataTable(dt1,False)
        End With
End Sel ect

老大求救,怎么点击查询按钮先查询数据然后再根据datatable生成表格,帮忙修改一下

--  作者:有点蓝
--  发布时间:2017/4/7 14:07:00
--  
简单一点就这样

S elect Cas e e.Path
Case "bjkc.htm"
    If e.PostValues.Count = 0 Then
        wb.AddForm("","form1","bjkc.htm")
        With wb.AddInputGroup("form1","ipg1","库存查询")
            .AddInput("bjmc","备件名称:","text")
        End With
        With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "查询", "submit")
        End With
    Else
        Dim cmd1 As New SQLCommand
        cmd1.C
        cmd1.CommandText = "SE L ECT ID AS 物料ID,JIGOU AS 所属机构,CANGKU AS 所属仓库,MINGCHENG AS 物料名称,SHULIANG AS 库存数量 F R OM KUCUN where 备件名称=\'" & e.PostValues("bjmc") & "\'"
        Dim dt1 As DataTable = cmd1.ExecuteReader
        With wb.AddTable("","Table1")
            .CreateFromDataTable(dt1,False)
        End With
    End If
End Sel ect