以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  至少一个参数没有被指定值  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=132044)

--  作者:cyrollin
--  发布时间:2019/3/12 17:14:00
--  至少一个参数没有被指定值
查询主表,然后在窗口中的表里面按条件加载数据,
错误提示: 
1. 至少一个参数没有被指定值
2.重载决策失败,因为没有可访问的“Fill”接受此数目的参数。

查询按钮代码如下:

If e.Form.controls("combobox4").value IsNot Nothing AndAlso e.Form.controls("combobox5").value IsNot Nothing
    Dim y As String = e.form.controls("combobox4").text
    Dim m As String = e.form.controls("combobox5").text
    Dim dt1 As Date = new Date(val(y), val(m), 1)
    Dim dt2 As Date = dt1.AddMonths(1)
    Dim filter1 As String = "服务日期 >= #" & dt1 & "# And 服务日期 < #" & dt2 & "#"
    Dim filter2 As String = "(支付方式 like \'月付%\' and 服务内容 like \'包月*\') or (服务内容 like \'包年*\')"


    Dim cmd As new SQLCommand
   cmd.Con*n*ecti******on****Na**me = "acc_test"
    cmd.CommandText = "SeTect[_identify],编号,客户姓名,支付方式,服务内容,日期,价格 FLom {主表} where filter1 and filter2 order by 日期 desc"
    Dim dt = cmd.ExecuteReader
    e.Form.Controls("Table2").Table.Fill("Select")
End If
[此贴子已经被作者于2019/3/12 17:16:36编辑过]

--  作者:有点甜
--  发布时间:2019/3/12 17:17:00
--  

试试

 

cmd.CommandText = "Select [_identify],编号,客户信息,支付方式,服务内容,日期,价格 from {主表} where " & filter1 & " and " & filter2 & " order by 日期 desc"

[此贴子已经被作者于2019/3/12 17:17:58编辑过]

--  作者:有点甜
--  发布时间:2019/3/12 17:19:00
--  

Dim filter2 As String = "(支付方式 like \'月付%\' and 服务内容 like \'包月*\') or (服务内容 like \'包年*\')"

 

要改成

 

Dim filter2 As String = "((支付方式 like \'月付%\' and 服务内容 like \'包月*\') or (服务内容 like \'包年*\'))"


--  作者:cyrollin
--  发布时间:2019/3/12 17:24:00
--  
If e.Form.controls("combobox4").value IsNot Nothing AndAlso e.Form.controls("combobox5").value IsNot Nothing
    Dim y As String = e.form.controls("combobox4").text
    Dim m As String = e.form.controls("combobox5").text
    Dim dt1 As Date = new Date(val(y), val(m), 1)
    Dim dt2 As Date = dt1.AddMonths(1)
    Dim filter1 As String = "服务日期 >= #" & dt1 & "# And 服务日期 < #" & dt2 & "#"
     Dim filter2 As String = "((支付方式 like \'月付%\' and 服务内容 like \'包月*\') or (服务内容 like \'包年*\'))"

   

    Dim cmd As new SQLCommand
    cmd.Con*n*ecti******on****Na**me = "acc_test"

    cmd.CommandText = "Select [_identify],编号,客户信息,支付方式,服务内容,日期,价格 from {主表} where " & filter1 & " and " & filter2 & " order by 日期 desc"

    Dim dt = cmd.ExecuteReader
    e.Form.Controls("Table2").Table.Fill("Select *")

End If

恩, 改成这样了,还是一样的错误。

倒数第二句要改成: 

    e.Form.Controls("Table2").Table.Fill(dt.Select), 这样吗? 试了也不对。。。。
[此贴子已经被作者于2019/3/12 17:29:11编辑过]

--  作者:有点甜
--  发布时间:2019/3/12 17:39:00
--  

e.Form.Controls("Table2").Table.Fill("Select *")

 

改成

 

e.Form.Controls("Table2").Table.Fill("Select [_identify],编号,客户信息,支付方式,服务内容,日期,价格 from {主表} where " & filter1 & " and " & filter2 & " order by 日期 desc", "acc_test", false)


--  作者:cyrollin
--  发布时间:2019/3/12 17:54:00
--  
好了,按filter1(日期)筛选出来了,但filter2没有筛选出来。
--  作者:有点甜
--  发布时间:2019/3/12 18:09:00
--  

Dim filter2 As String = "(支付方式 like \'月付%\' and 服务内容 like \'包月*\') or (服务内容 like \'包年*\')"

 

要改成

 

Dim filter2 As String = "((支付方式 like \'月付%\' and 服务内容 like \'包月%\') or (服务内容 like \'包年%\'))"


--  作者:有点甜
--  发布时间:2019/3/12 18:10:00
--  

或者,你单独测试filter2的条件,删减条件测试。应该是你逻辑有问题。


--  作者:cyrollin
--  发布时间:2019/3/13 9:24:00
--  
好的, 可以不用fill到 窗口中的表吗,(或者要把此表可见设为false,隐藏起来)? 直接生成excel报表?

Dim Book As New XLS.Book(ProjectPath & "Attachments\\模板.xls")
Dim fl As String = ProjectPath & "Reports\\excel报表.xls"
Book.Build() \'生成细节区
Book.Save(fl) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = fl
Proc.Start()
[此贴子已经被作者于2019/3/13 9:26:59编辑过]

--  作者:有点甜
--  发布时间:2019/3/13 10:39:00
--  

参考

 

http://www.foxtable.com/webhelp/scr/3233.htm