以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 在服务器生成一个文件,可以在手机上下载,哪里不对? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=180133) |
-- 作者:foxtablefanse -- 发布时间:2022/9/29 18:09:00 -- 在服务器生成一个文件,可以在手机上下载,哪里不对? \'操作证下载 ‘在服务器生成一个文件,可以在手机上下载,哪里不对? Dim e As RequestEventArgs = args(0) Dim wb As New weui Select Case e.Path Case "ZjDownLoad.htm" wb.Title = "只能下载本人的操作证" Dim nam As String Dim cmd As New SQLCom** cmd.Con** = "andb" \'记得设置数据源名称 cmd.Comt** = "sel ect [关联号],[文件名],[附件],[CRC值] fr om [Sys_附件] where [关联号]= (sel ect CredentialsID fr om [RL_员工证件] where 员工姓名 = \'" & e.Cookies("uname") & "\' and 证件名称=\'操作证\')" Dim dt As DataTable = cmd.Ex*R*d If dt.DataRows.Count > 0 Then Dim dr As DataRow = dt.DataRows(0) Dim fl As String = ProjectPath & "\\Project\\TempReportFiles\\" & dr("文件名") & ".pdf" If dr.SQLLoadFile("附件", fl) Then \'如果提取文件成功 \'生成下载链接 Dim sb As New StringBuilder sb.AppendLine("点附件名称直接下载! <br/><br/>") sb.AppendLine("<a href=\'" & fl & "\'>" & dr("文件名") & "</a>") e.WriteString(sb.ToString) End If End if e.WriteString(wb.Build) End Select
|
-- 作者:小美菜 -- 发布时间:2022/9/29 20:01:00 -- 我是这样做的,你慢慢品 .AddContent("文件" & (I + 1) & ": <a href=\'./Files/" & tFile & "\' download=\'" & tFile & "\'>" & tFile & "</a>")
|
-- 作者:有点蓝 -- 发布时间:2022/9/29 20:26:00 -- 1、注意路径:http://www.foxtable.com/mobilehelp/topics/0044.htm 2、参考2楼加上download属性
|
-- 作者:foxtablefanse -- 发布时间:2022/9/29 22:47:00 -- 改了一下代码,查询符串在查询分析器里能正常查询,怎么在这里就请示错误了呢? \'操作证下载 Dim e As RequestEventArgs = args(0) Dim wb As New weui Dim gf As String="C:\\myfiles\\企业微信1.0\\Project\\Attachments\\web\\" Select Case e.Path Case "ZjDownLoad.htm" wb.Title = "只能下载本人的操作证" Dim nam As String Dim cmd As New SQLCo cmd.C \'记得设置数据源名称 cmd.Com = "sel ect [关联号],[文件名],[附件],[CRC值] fr om [Sys_附件] where [关联号] = (sel ect CredentialsID fr om [RL_员工证件] where [员工姓名] = \'" & e.Cookies("uname") & "\' And [证件名称] = \'操作证\')" Dim dt As DataTable = cmd.Execu If dt.DataRows.Count > 0 Then Dim dr As DataRow = dt.DataRows(0) Dim pts() As String = dr.SQLGetValue("CRC值").Split("|") If FileSys.DirectoryExists(gf & "tempfiles")=False Then \'如果目录Catch不存在,则创建 FileSys.CreateDirectory(gf & "tempfiles") End If Dim fl As String = gf & "tempfiles\\" & dr("文件名") & "." & pts(0) If FileSys.FileExists(fl) AndAlso CRCCheckFile(fl) = pts(1) Then \'如果本地存在同名文件且CRC校验值相同 \'则直接使用本地文件 Else \'否则从数据库提取文件 If dr.SQLLoadFile("附件",fl) = False Then \'如果提取文件失败 With wb.AddMsgPage("","msgpage","出错啦!!","下载失败,主联系管理员!") .icon = "Warn" \'改变图标 .AddButton("btn1","返回").Attribute = "" End With Else \'生成下载链接 Dim sb As New StringBuilder sb.AppendLine("点附件名称直接下载! <br/><br/>") sb.AppendLine("证件: →<a href=\'./tempfiles/" & dr("文件名") & "\' download=\'" & dr("文件名") & "\'>" & dr("文件名") & "</a>") e.WriteString(sb.ToString) End If End If End If e.WriteString(wb.Build) End Select
|
-- 作者:有点蓝 -- 发布时间:2022/9/29 22:51:00 -- cmd.Com = "select [关联号],[文件名],[附件],[CRC值] from [Sys_附件] where [关联号] in (select CredentialsID from [RL_员工证件] where [员工姓名] = \'" & e.Cookies("uname") & "\' And [证件名称] = \'操作证\')" |
-- 作者:foxtablefanse -- 发布时间:2022/9/29 22:55:00 -- 蓝版辛苦了,用in也试过了,一样的错误提示 |
-- 作者:foxtablefanse -- 发布时间:2022/9/29 22:59:00 -- ![]() ![]() |
-- 作者:有点蓝 -- 发布时间:2022/9/29 23:04:00 -- 那就不应该是这里的问题,调试看看是哪一句代码出错 |