麻烦老师帮忙看看 为什么图片可以显示 文件就不能显示列表呢?
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim xingming As String = e.PostValues("待办人")
Dim shixiangmingcheng As String = e.PostValues("事项名称")
Dim src As String
wb.AddPageTitle("","ph1","事项管理","针对已经完成的事项,实现信息检索与查看!")
wb.AddForm("","form1","rwgetVimg.htm")
With wb.AddInputGroup("form1","ipg11","基础资料")
.AddInput("待办人","待办人","text").value = xingming
.AddInput("事项名称","事项名称","text").value = shixiangmingcheng
End With
Dim cmd As New SQL Command
cmd.Connection Name = "智慧党建"
cmd.CommandText="sele ct uuid from 待办事项 where 事项名称='" & shixiangmingcheng & "'and 待办人='" & xingming & "'and 完成情况='已完成'"
Dim dt As DataTable = cmd.ExecuteReader
Dim drr As DataRow= dt.SQLFind("[事项名称]='" & shixiangmingcheng & "'and [待办人]='" & xingming & "'and [完成情况]='已完成'")
Dim cmd11 As New SQLCommand
cmd11.Connecti
cmd11.CommandText="sel ect * from web上传图片附件 where 姓名='" & xingming & "'and 会议编号='" & drr("uuid") & "'"
Dim dt11 As DataTable = cmd11.ExecuteReader
With wb.AddInputGroup("form1","ipg1111","图片信息")
With .AddUploader("up111","",True)
.AllowAdd = False '关闭文件上传功能
For Each dr As DataRow In dt11.DataRows
Dim imagebytes As Byte() = dr("图片")
src = Convert.ToBase64String(imagebytes)
.AddImage("data:image/jpeg;base64," & src)
Next
End With
End With
With wb.AddInputGroup("form1","ipg111111","文件列表")
Dim drs As List(Of DataRow)
drs = dt11.Select("姓名= '" & xingming & "'and 会议编号= '" & drr("uuid") & "'")
If drs.count > 0 Then '如果找到的话
For Each dr As DataRow In drs
Dim fln As String = dr("图片名称")
MessageBox.Show(fln) 可以弹出非图片类别的文件名称
Dim Values() As String
Values = fln.Split(".")
If Values(1)="jpg" Or Values(1)="png" Or Values(1)="bmp" Then
Else
Dim wj1 As String ="./" & fln
Dim wj As String =ProjectPath & "Attachments\web\" & fln
If FileSys.FileExists(wj) Then '如果本地存在同名文件且CRC校验值相同
'则直接使用本地文件
Dim sb As New StringBuilder
sb.appendLine("<div>")
sb.appendLine("<a href='" & wj1 & "'>" & fln & "</a>")
sb.appendLine("</div>")
wb.InsertHTML("form1",sb.ToString)
Else '否则从数据库提取文件
If dr.SQLLoadFile("图片",wj) = True Then '如果提取文件失败
Dim sb1 As New StringBuilder
sb1.appendLine("<div>")
sb1.appendLine("<a href='" & wj1 & "'>" & fln & "</a>")
sb1.appendLine("</div>")
wb.InsertHTML("form1",sb1.ToString)
End If
End If
End If
Next
Else
Dim sb11 As New StringBuilder
sb11.appendLine("<div>")
sb11.appendLine("<a>没有对应的文件,请联系管理员!</a>")
sb11.appendLine("</div>")
wb.InsertHTML("form1",sb11.ToString)
End If
End With
With wb.AddInputGroup("form1","ipg33","")
With wb.AddButtonGroup("form1","btg1",False) '垂直排列
.Add("btn1", "继续检索", "submit").Form Action = "renwuchakan.htm"
.Add("btn2", "返回首页", "", "default1.htm")
End With
End With
e.WriteString(wb.Build) '生成网页
[此贴子已经被作者于2021/6/10 17:52:08编辑过]