Foxtable(狐表)用户栏目专家坐堂 → [求助]无法创建cookie,请老师看一下这段代码哪里错误?


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

主题:[求助]无法创建cookie,请老师看一下这段代码哪里错误?

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


加好友 发短信
等级:小狐 帖子:373 积分:2732 威望:0 精华:0 注册:2012/2/17 20:05:00
[求助]无法创建cookie,请老师看一下这段代码哪里错误?  发帖心情 Post By:2017/12/10 0:06:00 [只看该作者]

[求助]无法创建cookie,请老师看一下这段自定义函数的代码哪里错误?
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Select Case e.Path
    '7------- 以下为康复管理页的代码
    Case "addnewkf.htm" '康复管理页面
        If e.PostValues.Count = 0 Then
            With wb.AddInputGroup("form1","ipg1","康复管理")
                With .AddInput("客户编号","客户编号","")
                    .Placeholder = "编号为客户手机号"
                End With
                .AddInput("客户姓名","客户姓名","Text")
                .AddInput("康复离店时间","康复时间","date").Value = Format(Date.Today,"yyyy-MM-dd")
                .AddInput("经办人","经办人","Text").value = e.Cookies("JBR")
            End With
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            End With
            Dim jbr As String = e.PostValues("经办人")
            wb.AppendCookie("JBR",jbr) '经办人的值写入cookie
            e.WriteString(wb.Build) '生成网页
        Else
            Dim nms() As String = {"客户编号","客户姓名","康复离店时间","经办人"}
            Dim dr As DataRow = DataTables("康复离店").AddNew()
            For Each nm As String In nms
                dr(nm) = e.PostValues(nm)
            Next
            ''保存并生成增加成功提示页面
            dr.save()
            With wb.AddMsgPage("","msgpage","增加成功", "你真棒!继续加油!") '生成成功提示页
                .AddButton("btn1","继续增加","addnewkf.htm")
                .AddButton("btn2","返回主页","default.htm")
            End With
            e.WriteString(wb.Build)
        End If
End Select
e.WriteString(wb.Build) '生成网页

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


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

参考代码

 

Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Select Case e.Path
    Case "addnewkf.htm" '康复管理页面
        If e.PostValues.Count = 0 Then
            wb.AddForm("","form1","addnewkf.htm")
            With wb.AddInputGroup("form1","ipg1","康复管理")
                With .AddInput("客户编号","客户编号","")
                    .Placeholder = "编号为客户手机号"
                End With
                .AddInput("客户姓名","客户姓名","Text")
                .AddInput("康复离店时间","康复时间","date").Value = Format(Date.Today,"yyyy-MM-dd")
                .AddInput("经办人","经办人","Text").value = e.Cookies("JBR")
            End With
            With wb.AddButtonGroup("form1","btg1",True)
                .Add("btn1", "确定", "submit")
            End With
            e.WriteString(wb.Build) '生成网页
        Else
            Dim jbr As String = e.PostValues("经办人")
            wb.AppendCookie("JBR",jbr) '经办人的值写入cookie
            'Dim nms() As String = {"客户编号","客户姓名","康复离店时间","经办人"}
            'Dim dr As DataRow = DataTables("康复离店").AddNew()
            'For Each nm As String In nms
            'dr(nm) = e.PostValues(nm)
            'Next
            '''保存并生成增加成功提示页面
            'dr.save()
            With wb.AddMsgPage("","msgpage","增加成功", "你真棒!继续加油!") '生成成功提示页
                .AddButton("btn1","继续增加","addnewkf.htm")
                .AddButton("btn2","返回主页","default.htm")
            End With
            e.WriteString(wb.Build)
        End If
End Select


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


加好友 发短信
等级:小狐 帖子:373 积分:2732 威望:0 精华:0 注册:2012/2/17 20:05:00
  发帖心情 Post By:2017/12/10 15:57:00 [只看该作者]

没问题了。谢谢老师!

 回到顶部