以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  跳转页面后,前面页面的msgbox还在执行提示  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=99187)

--  作者:zhangjian222200
--  发布时间:2017/4/14 9:12:00
--  跳转页面后,前面页面的msgbox还在执行提示
.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2017.3.18.1
错误所在事件:自定义函数index
详细错误信息:
调用的目标发生了异常。
未将对象引用设置到对象的实例。

执行下述代码,提示上述错误:(见下述粉色字体)
Dim e As RequestEventArgs = args(0)                                \'首页
Select Case e.Path
    Case "index.htm"
        Dim wb As New weui
        msgbox(1)
        Dim username As String = e.cookies("isj") \'从cookie取会员手机号
        \'Dim huiydj As String \'定义,会员等级
        msgbox(2)
        Dim drs As List(of DataRow) \'用于存放展示在首页的会员编号
        Dim drr As DataRow \'会员在"会员资料"表中的行
        Dim xb As String \'定义,性别
        msgbox(3)
        Dim qr As String = e.cookies("querwdlxb") \'定义,游客是否已经进入过"确认性别"页面(符合条件时,在本页删除) \'"确认性别"页面增加了:e.AppendCookie("querwdlxb",queren) \'确认游客已经进入了"确认性别"页面
        Dim i As Integer  \'记录首页展示人数,即for each语句循环次数
        msgbox(4)
        If username IsNot Nothing Then \'如果cookie中,有会员手机号:取已登录会员的性别|会员等级
            msgbox(5)
            drr = DataTables("会员资料").sqlFind("手机 = \'" & username & "\'") \'查找会员所在的行
            If drr IsNot Nothing Then
                msgbox(6)
                xb = drr("性别")
                wb.DeleteCookie("querxb") \'如果用户登录前,访问首页时,前一个页面曾将性别保存cookie,则在这里删除cookie(因为用户已经登录,不必再确认性别了)
                \'huiydj = drr("会员等级")
            End If
        End If
        msgbox(7)
        If xb = "" AndAlso qr = "ok" Then \'如果前面没有取得性别(意思是:当上一段没有从cookie中取得性别,又到过性别确认页面(注意:不能保证是否点击了性别!))
            For Each key As String In e.GetValues.Keys \'取未登录会员性别
                msgbox(8)
                If key = "sex" Then
                    xb = e.GetValues(key)
                    If xb = 1 Then
                        xb = "男"
                        msgbox("性别:" & xb)
                        e.AppendCookie("querxb",xb) \'这个cookie,若用户登录后,将在本页前面代码中删除
                    ElseIf xb = 0 Then
                        xb = "女"
                        msgbox("性别:" & xb)
                        e.AppendCookie("querxb",xb) \'这个cookie,若用户登录后,将在本页前面代码中删除
                    End If
                End If
            Next
        End If
        msgbox(9)
        If xb = "" Then \'这里用来第一次之后,访问时,确认游客性别(从上一段代码生成的cookie中,取性别)
            xb = e.cookies("querxb")
        End If
        msgbox(10)
        If xb = "" Then \'性别,经过上述赋值,还是为空,跳转到index0.htm,进行性别确认
            wb.InsertHTML("<meta http-equiv=\'Re-fresh\' con-tent=\'0; u-rl=/index0.htm\'>") \'那么直接跳转到:确认性别页面
             ’这里执行了,跳转页面,进入了index0.htm,但是下面11~19还是在执行,执行19后,提示错误
            e.WriteString(wb.Build) \'生成网页
        End If
        msgbox(11)
        wb.DeleteCookie("querwdlxb")
        \'到这里必须删除,确认性别页面添加的cookie(这样,利于下次执行)
        msgbox(12)
        If xb = "男" Then \'如果会员女生,则显示男生
            drs = DataTables("会员资料").SQLSelect("[性别] = \'女\'",4,"会员编号 DESC")  \'从订单表找,个人订单集合
        Else \'其他情况,显示男生
            drs = DataTables("会员资料").SQLSelect("[性别] = \'男\'",4,"会员编号 DESC")  \'从订单表找,个人订单集合
        End If
        msgbox(13)
        wb.AddForm("","form1","indexb.htm")
        For Each dr As DataRow In drs
            msgbox(14)
            Dim zhansz As String = dr("展示照") \'定义,年龄
            Dim bianh As String = dr("会员编号") \'定义,年龄
            Dim nianl As String = dr("年龄") \'定义,年龄
            Dim xuel As String = dr("学历") \'定义,学历
            Dim huny As String = dr("婚姻状况") \'定义,婚姻状况
            Dim suozqx As String = dr("所在区县") \'定义,所在区县
            Dim suozshi As String = dr("所在市") \'定义,所在市
            Dim suozs As String = dr("所在省") \'定义,所在省
            msgbox(15)
            With wb.AddArticle("","ar" & bianh)
                .AddImage("./" & zhansz)
                \'.AddImage("./images/zhanshi/" & zhansz)
                msgbox("编号:" & bianh & "照片:" & zhansz)
                .Attribute = "style=\'padding:0.5em;\'"
            End With
            wb.AddForm("","form" & bianh,"indexb.htm")
            msgbox(16)
            With wb.AddInputGroup("form" & bianh,"ipg" & bianh,"TA的编号:" & bianh)
                With .AddInput("xm" & bianh,"有关于TA:","text")
                    .Value = nianl & "岁|" & xuel & "|" & huny
                    .Readonly= True
                End With
                With .AddInput("pw" & bianh,"所在城市:","text")   \' "\'">"\'" ,表达式留存
                    .Value = suozqx & ">" & suozshi & ">" & suozs
                    .Readonly= True
                End With
            End With
            msgbox(17)
            With wb.AddButtonGroup("form" & bianh,"btg" & bianh,False)
                .Add("btn1" & bianh, "查看TA的资料", "","/details.htm?bh=" & bianh)
            End With
            i = i+1
            msgbox(18)
            If (i Mod 4) = 0 Then
            msgbox(19)          \'执行19后,提示错误,下面的20~22没有提示
                \'这里需要传递:会员性别|当前编号|会员等级
                e.AppendCookie("bianhcd",bianh)  \'编号传递,将本页展示的最后一个需要存入cookie,作为下一个插入页面,开始序号(sqlselect用)
                \'msgbox("cookie:" & e.cookies("xingbcd")) 显示cookie的方法,不需要,暂保存
                \'msgbox("xb:" & xb)
                e.AppendCookie("xingbcd",xb)  \'性别传递,展示用户性别
                \'e.AppendCookie("huiydjcd",huiydj)  \'会员等级传递,暂时屏蔽
            End If
        Next
        msgbox(20)
        wb.insertHTML("","<div id=\'p1\' style=\'margin:0.5em\'></div>") \'插入一个div,用于显示服务器返回的 页面
        wb.insertHTML("","<div id=\'p2\' style=\'margin:0.5em\'></div>")
        wb.insertHTML("","<div></div>")
        With wb.AddButtonGroup("","btg0", False)
        msgbox(21)
            \'.Add("btns1", "加载更多").Att-ribute = "sty-le=\'background-color:gary\' on-click=\'to-ngji()\'"
            \'.Add("btns2", "筛选条件").Kind = 1
            .Add("btns", "加载更多").Attr-ibute= "on-click= \'in-dex()\'"
        End With
        msgbox(22)
        wb.AppendHTML("<script src=\'./lib/ajaxform_index.js\'></script>") \'引入脚本文件
        e.WriteString(wb.Build) \'生成网页
End Select
[此贴子已经被作者于2017/4/14 9:13:25编辑过]

--  作者:有点色
--  发布时间:2017/4/14 9:17:00
--  

 红色那里,就可以直接return了

 

e.WriteString(wb.Build) \'生成网页

return