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 SQL Command
cmd11.Connection Name = "智慧党建" '记得设置数据源名称
cmd11.CommandText = "Sel ct * From {待办事项}"
Dim dt As DataTable = cmd11.ExecuteReader
If e.PostValues.Count = 0 Then
wb.AddPageTitle("","ph1","事项管理","【事项完成时,待办人无名单;请选择名单后进行对应操作!】")
wb.AddForm("","form1","renwu.htm")
With wb.AddInputGroup("form1","ipg1","基础信息")
'前一个"姓名"是ID,后一个"姓名"是标题
With .AddSelect("待办人","待办人","|" & dt.GetComboListString("待办人","完成情况='未完成'"))
.Attribute = """
End With
.AddSelect("事项名称","事项名称","")
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").Attri bute= "onc lick='rwsubmitForm()'" '调用js函数上传
.Add("btn2", "取消上传", "submit").FormAction = "default1.htm"
End With
wb.AddToast("","tst1", "正在上传",1)
wb.AddToast("","tst2", "上传成功",0)
wb.AddToast("","tst3", "上传失败",0).Icon= "warn"
wb.InsertHTML("<script>" & vars("ajaxform") & "</script>")'引入脚本文件
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.Find("[事项名称]='" & shixiangming & "'")
这里可以弹出e.PostValues("事项名称");e.PostValues("待办人");dr("uuid")三个的值
Dim cmd111 As New SQ LCommand
cmd111.Connecti
Dim sql As String ="UPD ATE 待办事项 S ET 完成情况='已完成' 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
以下代码运行正常 后台二进制数据写入
For Each key As String In e.Files.Keys
If key = "up1" Then
For Each fln As String In e.Files(key)
Dim wj As String =ProjectPath & "Attachments\" & fln
e.SaveFile(key,fln,wj)
Dim cmd1 As New SQL Command
cmd1.Connecti
cmd1.CommandText = "Inse rt Into web上传图片附件 (会议编号,姓名,时间戳,图片名称,图片) Values(?,?,?,?,?)"
cmd1.Parameters.Add("@会议编号", dr("uuid"))
cmd1.Parameters.Add("@姓名", xingming)
cmd1.Parameters.Add("@时间戳", t)
cmd1.Parameters.Add("@图片名称", FileSys.GetName(wj))
Dim ImageByte() As Byte = System.IO.File.ReadAllBytes(wj) '读取文件流,并将读到的二进制数据放入数组ImageByte中,
cmd1.Parameters.Add("@图片", ImageByte)
cmd1.ExecuteNonQuery
Next
End If
If key = "up2" Then
For Each fln As String In e.Files(key)
Dim wj As String =ProjectPath & "Attachments\" & fln
e.SaveFile(key,fln,wj)
Dim cmd1 As New SQLCo mmand
cmd1.ConnectionN ame = "智慧党建"
cmd1.CommandText = "Ins ert Into web上传图片附件 (会议编号,姓名,时间戳,图片名称,图片) Values(?,?,?,?,?)"
cmd1.Parameters.Add("@会议编号", dr("uuid"))
cmd1.Parameters.Add("@姓名", xingming)
cmd1.Parameters.Add("@时间戳", t)
cmd1.Parameters.Add("@图片名称", FileSys.GetName(wj))
Dim ImageByte() As Byte = System.IO.File.ReadAllBytes(wj) '读取文件流,并将读到的二进制数据放入数组ImageByte中,
cmd1.Parameters.Add("@图片", ImageByte)
cmd1.ExecuteNonQuery
Next
End If
Next
e.WriteString("OK")
End If