Foxtable(狐表)用户栏目专家坐堂 → HttpRequest 未将对象引用设置到对象的实例 ,麻烦老师看看。


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

主题:HttpRequest 未将对象引用设置到对象的实例 ,麻烦老师看看。

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


加好友 发短信
等级:九尾狐 帖子:2472 积分:17346 威望:0 精华:0 注册:2013/1/31 0:03:00
HttpRequest 未将对象引用设置到对象的实例 ,麻烦老师看看。  发帖心情 Post By:2019/4/15 10:14:00 [只看该作者]

.NET Framework 版本:2.0.50727.8940
Foxtable 版本:2018.10.9.1
错误所在事件:项目,HttpRequest
详细错误信息:
未将对象引用设置到对象的实例。


    Case "addnewtxl.htm"
        If e.PostValues.Count = 0 Then
            wb.AddForm("","form1","addnewtxl.htm")
            With wb.AddInputGroup("form1","ipg1","干警信息")               
                Dim filter11 As String = "表名 = '干警信息' and 列名 = '所在单位' and 停用 = false"
                Dim fdr11 As DataRow = DataTables("列项设置").Find(filter11)
                If fdr11 IsNot Nothing Then
                    Dim abc11 As String=fdr11("下拉选项").replace(",", "|")
                    .AddSelect("所在单位","所在单位","|"&abc11)
                End If              
                .AddInput("姓名","姓名","Text") '前一个"姓名"是ID,后一个"姓名"是标题
                .AddInput("电话","电话","number")
                .AddInput("电子邮件","电子邮件","text")
                .AddInput("QQ号","QQ号","text")
                .AddInput("微信号","微信号","text") 
                Dim filter As String = "表名 = '干警信息' and 列名 = '身份属性' and 停用 = false"
                Dim fdr As DataRow = DataTables("列项设置").Find(filter)
                If fdr IsNot Nothing Then
                    Dim abc As String=fdr("下拉选项").replace(",", "|")
                    .AddSelect("身份属性","身份属性","|"&abc)
                End If  
                Dim filter1 As String = "表名 = '干警信息' and 列名 = '关注领域' and 停用 = false"
                Dim fdr1 As DataRow = DataTables("列项设置").Find(filter1)
                If fdr1 IsNot Nothing Then
                    Dim abc1 As String=fdr1("下拉选项").replace(",", "|")
                    .AddSelect("关注领域","关注领域","|"&abc1)
                End If  
            End With
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
                .Add("btn2","取消","reset")
            End With
            
            With wb.AddTable("","Table1")
                .RowHead = 1
                .ColWidth = "12px"
                Dim nms() As String = {"姓名","电话","电子邮件","身份属性","所在单位"}
                .Head.AddRow(nms)
                Dim cnt As Integer
                For Each r As DataRow In DataTables("干警信息").Select("姓名 <>''")
                    cnt = cnt + 1
                    With .Body.AddRow(r("姓名"),r("电话"),r("电子邮件"),r("身份属性"),r("所在单位"))
                        '.AddCell(Format(r("单价"),"#0.00"))
                        '.AddCell(Format(r("日期"),"MM月dd日"))
                    End With
                Next
            End With
            e.WriteString(wb.Build)
        Else
            Dim nms() As String = {"姓名","电话"} '不能为空的列名数组
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) = False Then '生成错误提示页
                    With wb.AddMsgPage("","msgpage","增加失败", nm & "列不能为空!")
                        .icon = "Warn" '改变图标
                        .AddButton("btn1","返回").Attribute = ""
                    End With
                    e.WriteString(wb.Build)
                    Return '必须返回
                End If
            Next
            nms = New String() {"姓名","电话","电子邮件","身份属性","所在单位","关注领域","微信号","QQ号"}  '重新定义了nms数组,增加了两列.
            Dim dr As DataRow = DataTables("干警信息").AddNew()
            For Each nm As String In nms
                If e.PostValues.ContainsKey(nm) Then
                    dr(nm) = e.PostValues(nm)                    
                End If
            Next
            If dr("所在单位") <>"" Then
                Dim dr11 As DataRow
                dr11 = DataTables("行政区域").Find("所在单位 = '"&dr("所在单位")&"' ")
                dr("所在省份")=dr11("所在省份")
                dr("所在地区")=dr11("所在地区")
                dr("所在县份")=dr11("所在县市")
            End If
            With wb.AddMsgPage("","msgpage","增加成功", "好好学习,天天向上") '生成成功提示页
                .AddButton("btn1","继续增加","addnewtxl.htm")
            End With           
            e.WriteString(wb.Build)
        End If

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


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

这段代码,对dr11进行判断才行,如

 

                Dim dr11 As DataRow
                dr11 = DataTables("行政区域").Find("所在单位 = '"&dr("所在单位")&"' ")
msgbox(dr("所在单位"))
If dr11 IsNot Nothing Then
                dr("所在省份")=dr11("所在省份")
                dr("所在地区")=dr11("所在地区")
                dr("所在县份")=dr11("所在县市")
End If

 回到顶部