以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 网页保存问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=152645) |
|
-- 作者:刘林 -- 发布时间:2020/7/17 10:32:00 -- 网页保存问题 \'\'\' Dim e As RequestEventArgs = args(0) Dim wb As New weui wb.InsertHTML("<script src=\'../mui/js/mui.min.js\'></script>") wb.InsertHTML("<script Type=\'text/javascript\' charset=\'utf-8\'>mui.init();</script>") wb.InsertHTML("<style> div.weui_msg{position: absolute; top: 50%;left: 50%;transform:translate(-50% ,-50%) }</style>") wb.InsertHTML("<style>.weui_msg .weui_msg_desc{width:400px;}</style>") Dim pr As DataRow Dim cmd As new SQLCommand cmd.C cmd.CommandText = "sect 学生姓名,身份证件号,户籍地址,家庭住址,联系电话,提请审核,审核锁定,监护人姓名,是否建档立卡,留守情况,户口性质,就读方式,就餐分类,政治面貌,民族,健康状况,审核锁定,审核结论,备注,申读学校,申读班级,性别,出生日期,学籍号,_Identify From {学生信息} WHERE 身份证件号 = \'" & e.Cookies("username") & "\'" Dim dt As DataTable = cmd.ExecuteReader(True) If dt.DataRows.count>0 pr=dt.DataRows(0) End If 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" \'改变图标 Dim btn1 = .AddButton("btn1","返回填写") btn1.kind=1 btn1.Attribute= "style=\'width:150px;border-radius:20px;border:1px solid silver;\'" End With e.WriteString(wb.Build) Return true\'必须返回 End If Next nms = new String() {"学生姓名","家庭住址","户籍地址","联系电话","留守情况","健康状况","是否建档立卡","邮政编码","户口性质","民族","政治面貌","监护人姓名","就读方式","就餐分类","申读学校","申读班级","学籍号"} messagebox.show("问题1") For Each nm As String In nms messagebox.show(nm) If e.PostValues.ContainsKey(nm) pr(nm)=trim(e.postvalues(nm)) End If Next messagebox.show("问题2") pr("性别")=ReadSex(e.Cookies("username")) pr("出生日期")=ReadBirthDay(e.Cookies("username")) pr("提请审核")=True messagebox.show("lsjsljd111") With wb.AddMsgPage("","msgpage","审核提交成功", "返回学生列表") \'生成成功提示页 End With pr.save() e.WriteString(wb.Build) e.Handled=True 请问老师,这个代码没改,今天出了问题,红色部分的1能显,2不能显, messagebox.show(nm)只显示了学生信息就不行了,问题没找到是什么,请老师指定 |
|
-- 作者:有点蓝 -- 发布时间:2020/7/17 10:40:00 -- messagebox.show("问题1") For Each nm As String In nms messagebox.show(nm) If e.PostValues.ContainsKey(nm) messagebox.show(e.postvalues(nm)) pr(nm)=trim(e.postvalues(nm)) messagebox.show(pr(nm)) End If Next messagebox.show("问题2")
|
|
-- 作者:刘林 -- 发布时间:2020/7/17 10:52:00 -- 这样测试只显了学生姓名,和学生姓名值就不显示了,也就是没有循环了,这个代码之前是好的 [此贴子已经被作者于2020/7/17 10:52:24编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2020/7/17 11:02:00 -- 那就是这句代码有问题:pr(nm)=trim(e.postvalues(nm)) 确定列名是对的。另外这个pr可能是空值,比如查询没有结果 Dim dt As DataTable = cmd.ExecuteReader(True) If dt.DataRows.count>0 pr=dt.DataRows(0) End If msgbox(pr is nothing)
|
|
-- 作者:刘林 -- 发布时间:2020/7/17 11:12:00 -- 我一一对了列名是有的,表没改过,之前也是对的,并且我nms只留一列测试也不行 |
|
-- 作者:有点蓝 -- 发布时间:2020/7/17 11:14:00 --
|