以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 怎么根据条件找到符合的行后判断页面显示内容? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=169280) |
-- 作者:cnsjroom -- 发布时间:2021/6/10 1:46:00 -- 怎么根据条件找到符合的行后判断页面显示内容? 页面代码如下: 红色部分代码没有起作用…页面永远只显示下划线部分的内容…麻烦老师帮忙看看! Dim e As RequestEventArgs = args(0) Dim wb As New weui Dim xingming As String = e.PostValues("待办人") Dim shixiangming As String = e.PostValues("事项名称") Dim vals As String Dim cmd11 As New SQLCommand cmd11.Connectio nName = "智慧党建" \'记得设置数据源名称 cmd11.CommandText = "Sel ect * From {待办事项}" Dim dt As DataTable = cmd11.ExecuteReader If e.PostValues.Count = 0 Then wb.AddPageTitle("","ph1","事项管理","【事项完成时,待办人无名单;请选择名单后进行对应操作!】") wb.AddForm("","form1","smrenwu.htm") Dim dr As DataRow= dt.S QLFind("[事项名称]=\'" & shixiangming & "\'and [待办人]=\'" & xingming & "\'and [完成情况]=\'未完成\'") If dr IsNot Nothing Then 当记录不是空值时 也就是找到行时 显示可以上传的页面 反之就显示不能上传的页面 同时提醒tst4的内容 With wb.AddInputGroup("form1","ipg1","基础信息") .AddInput("待办人","待办人","text").Value = e.GetValues("a") .AddInput("事项名称","事项名称","text").Value = e.GetValues("b") End With wb.AddTopTips("","toptip1","请选择待办人和事项名称!") With wb.AddInputGroup("form1","ipg2","文件上传") \'文件上传 With.AddUploader("up1","请点击+号选择需要上传的文件",True) \'True表示允许上传多个文件 .AllowDelete = True \'允许删除 .Incremental = True \'允许重复选择文件或连续拍照 .ScaleWidth = 1024 End With Dim sb As New StringBuilder sb.appendLine("<div>") sb.appendLine("单文件上传: <input type=\'file\' name=\'up1\' id=\'up1\'><br/>") sb.appendLine("多文件上传: <input type=\'file\' name=\'up2\' id=\'up2\' multiple>") sb.appendLine("</div>") wb.InsertHTML("form1",sb.ToString) End With With wb.AddButtonGroup("form1","btg1",False) .Add("btn1", "确定上传", "button").Attr ibute= "onc lick=\'smrwsubmitForm()\'" \'调用js函数上传 .Add("btn2", "取消上传", "submit").FormA ction = "default1.htm" End With wb.AddToast("","tst1", "正在上传",1) wb.AddToast("","tst2", "上传成功",0) wb.AddToast("","tst3", "上传失败",0).Icon= "warn" wb.AddToast("","tst4", "你已经上传过,请勿重复上传!",0).Icon= "warn" wb.InsertHTML("<script>" & vars("ajaxform") & "</script>")\'引入脚本文件 Else With wb.AddInputGroup("form1","ipg1","基础信息") .AddInput("待办人","待办人","text").Value = e.GetValues("a") .AddInput("事项名称","事项名称","text").Value = e.GetValues("b") .AddInput("完成情况","完成情况","text").Value = “已完成请勿重复操作!” End With End If e.WriteString(wb.Build) Else Dim st As New Date(1970,1,1,8,0,0) Dim d As Date = cdate("2020-02-01") Dim t As Long = (Date.Now - st).TotalSeconds() Dim dr As DataRow= dt.SQLF ind("[事项名称]=\'" & shixiangming & "\'and [待办人]=\'" & xingming & "\'and [完成情况]=\'未完成\'") Dim cmd111 As New SQ LCommand cmd111.Connectio nName = "智慧党建" Dim sql As String ="UPDA TE 待办事项 SET 完成情况=\'已完成\' WHERE 事项名称=? and 待办人=? and uuid=? " cmd111.CommandText = sql cmd111.Parameters.Add("@事项名称", e.PostValues("事项名称")) cmd111.Parameters.Add("@待办人", e.PostValues("待办人")) cmd111.Parameters.Add("@uuid", dr("uuid")) cmd111.ExecuteNonQuery e.WriteString("OK") End If [此贴子已经被作者于2021/6/10 3:36:26编辑过]
|
-- 作者:有点蓝 -- 发布时间:2021/6/10 9:15:00 -- 逻辑本身就不合理,既然判断了【If e.PostValues.Count = 0 Then】说明【e.PostValues("待办人")】是不存在的,也就是xingming、shixiangming变量不会有值,所以不会存在符合条件的数据 |
-- 作者:cnsjroom -- 发布时间:2021/6/10 10:23:00 -- 回复:(有点蓝)逻辑本身就不合理,既然判断了【If e... 老师那怎么解决呢? 取消=0的判断么? 我试过取消了也是一样的显示下划线部分
|
-- 作者:有点蓝 -- 发布时间:2021/6/10 10:28:00 -- 学会调试 1、说明没有传入必要的数据Dim xingming As String = e.PostValues("待办人") msgbox(xingming) …… 2、没有符合条件的数据 msgbox("[事项名称]=\'" & shixiangming & "\'and [待办人]=\'" & xingming & "\'and [完成情况]=\'未完成\'")
|