Foxtable(狐表)用户栏目专家坐堂 → Exception has been thrown by the target of an invocation.


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

主题:Exception has been thrown by the target of an invocation.

帅哥哟,离线,有人找我吗?
hailong
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:1 积分:70 威望:0 精华:0 注册:2020/1/15 13:25:00
Exception has been thrown by the target of an invocation.  发帖心情 Post By:2020/8/2 11:10:00 [只看该作者]

请问老师:使用内部函数打开网页时出现提示“.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2020.5.29.8
错误所在事件:自定义函数,wyyc
详细错误信息:
Exception has been thrown by the target of an invocation.
Cannot find column -1.

如何处理。

 

DateTable如下:

表1:可用车辆   提供车辆列表数据(通过点击区域列出网点,再选择网点列出车牌同时也列出此车牌对应的车架号)

表2:订单  接收并保存订单数据

 

代码如下:

 

Dim e As  RequestEventArgs = args(0)
Select Case e.Path
    Case "wyyc.htm"
        Dim wb As New weui
        wb.AddForm("","form1","handle.htm") '指定接收表单数据的的页面为handle.htm
        With wb.AddInputGroup("form1","ipg1","新增出行订单")
            With .AddInput("订单编号","订单编号:","text")
                .Value = Functions.Execute("GetOrderID")
                .Readonly = True
             End With
            With .AddInput("用户手机","用户手机:","text")
                .Value = e.Cookies("username")
                .Readonly = True
            End With
            With .AddInput("时间","下单时间:","datetime")
                .Value = Date.now()
                .Readonly = True
            End With
        End With
       With wb.AddInputGroup("form1","ipg2","选择网点可用车辆")
            With .AddSelect("dq","地区","|" & DataTables("可用车辆").GetComboListString("地区 "))
                .Attribute = """
            End With
            With .AddSelect("wd","网点","")
                .Attribute = """
            End With
            With .AddSelect("cp","车牌","")
                .Attribute = """
            End With
            .AddSelect("cj","车架","")
       End With
       
        With wb.AddInputGroup("form1","ipg2","选择网点可用车辆")
            With.AddSelect("dq","地区","|" & DataTables("可用车辆").GetComboListString("地区"))
            .Attribute = """
         End With
         With .AddSelect("wd","网点地址","")
            .Attribute = """
         End With
        With  .AddSelect("cp","车牌号","")
          .Attribute = """
         End With
        .AddSelect("cj","车架号","")
        End With
 With wb.AddButtonGroup("form1","btg1",True)
            .Add("btn1", "确定", "button").Attribute= ""
            .Add("btn2", "取消", "button","default.htm")
        End With
        'End With
        e.WriteString(wb.Build) '生成网页
    Case  "getProducts.htm"
        Dim vals As String
        If e.PostValues.Count = 1 Then
            vals  = "|" & DataTables("可用车辆").GetComboListString("网点","地区='" &  e.PostValues("dq") & "'")
        ElseIf e.PostValues.Count = 2 Then
            Dim Filter As String = "地区='" & e.PostValues("dq") & "' And 网点='" &  e.PostValues("wd") & "'"
            vals = "|" & DataTables("可用车辆").GetComboListString("车牌", Filter)
        ElseIf e.PostValues.Count = 3 Then
            Dim Filter1 As String = "网点='" & e.PostValues("wd") & "' And 车牌='" &  e.PostValues("cp") & "'"
            vals = "|" & DataTables("可用车辆").GetComboListString("车架", Filter1)
        End If
        e.WriteString(vals)

    Case "handle.htm"
        Dim nms() As String = {"订单编号","用户手机","下单时间","取车网点","车牌号","车架号"}
        For Each nm As String In nms
            If e.PostValues.ContainsKey(nm) = False Then
                e.WriteString("请输入" & nm & "!") '返回错误消息
                Return"" '必须返回
            End If
        Next
        Dim dr As DataRow = DataTables("订单").AddNew()
        For Each nm As String In nms
            dr(nm) = e.PostValues(nm)
        Next
        dr.Save()
        e.WriteString("OK") '返回增加成功消息
End Select


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:111390 积分:567014 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/8/2 11:41:00 [只看该作者]

看那一句代码出错,调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm

With .AddSelect("dq","地区","|" & DataTables("可用车辆").GetComboListString("地区 ")) 有个多余空格

    Case  "getProducts.htm"
        Dim vals As String
        If e.PostValues.Count = 1 Then
msgbox(e.PostValues("dq")) ‘看看传入什么值
            vals  = "|" & DataTables("可用车辆").GetComboListString("网点","地区='" &  e.PostValues("dq") & "'")
        ElseIf e.PostValues.Count = 2 Then
            Dim Filter As String = "地区='" & e.PostValues("dq") & "' And 网点='" &  e.PostValues("wd") & "'"
msgbox(Filter ) ‘看看传入什么值
            vals = "|" & DataTables("可用车辆").GetComboListString("车牌", Filter)
        ElseIf e.PostValues.Count = 3 Then
            Dim Filter1 As String = "网点='" & e.PostValues("wd") & "' And 车牌='" &  e.PostValues("cp") & "'"
msgbox(Filter1 ) ‘看看传入什么值
            vals = "|" & DataTables("可用车辆").GetComboListString("车架", Filter1)
        End If
        e.WriteString(vals)

 回到顶部