excel - 在经典asp中导出到excel停止工作
问题描述
过去几天突然间,我们注意到导出到 excel 和 word 在经典的 asp 屏幕中不起作用。据我所知,代码没有问题。我认为这与 Microsoft 的某些安全更新或其他问题有关。谁能帮我解决这个问题
错误:
无法访问此站点
/Common/PtSchNoShowsExportToFile.asp?txtFromDt=12/08/2019&txtToDt=01/08/2020&appl=vnd.ms-excel&type=NoShow 的网页可能暂时关闭,或者它可能已永久移动到新的网址。
ERR_INVALID_RESPONSE
代码:
<%@ Language=VBScript %>
<%Response.expires = -1%>
<%
'Change HTML header to specify Excel's MIME content type
Response.Buffer = TRUE
Response.ContentType = "application/" & request("appl")
dim filename
filename = "No Show Report.xls"
filename = Replace(filename, " ", "%20")
Response.AddHeader "Content-Disposition", "attachment;filename="&filename
Function FormatDate(strDate)
dim arrDate
dim length
if (strDate=null) then
FormatDate=strDate
else
arrDate=Split(strDate,"/")
length=UBound(arrDate)
if(length>1) then
if(len(arrDate(0))=1) then
arrDate(0)="0" + arrDate(0)
end if
if(len(arrDate(1))=1) then
arrDate(1)="0" + arrDate(1)
end if
FormatDate=arrDate(0) +"/" + arrDate(1) + "/" + arrDate(2)
else
FormatDate=strDate
end if
end if
End Function
%>
<HTML>
<body>
<%
'--Connection String
set Cnn = server.CreateObject("ADODB.connection")
Cnn.ConnectionString = Application("MyConnectionStringGoesHere")
Cnn.open
set rs = Cnn.Execute("Sp_Report_ScheduleV4_NoShows @StartDate='" & request("txtFromDt") & "',@EndDate='" & request("txtToDt") & "'")
%>
<TABLE WIDTH = 75% BORDER=1 CELLSPACING=1 CELLPADDING=1>
<TR>
<TD><font size=+2>Provider</TD>
<TD><font size=+2>Date & Time</TD>
<TD><font size=+2>Day</TD>
<TD><font size=+2>Site</TD>
<TD><font size=+2>Reason</TD>
<TD><font size=+2>Chart</TD>
<TD><font size=+2>Name</TD>
<TD><font size=+2>Type</TD>
<TD><font size=+2>Home#</TD>
<TD><font size=+2>work#</TD>
<TD><font size=+2>Cancel Reason</TD>
</TR>
<% Do while not rs.EOF %>
<TR>
<TD><%=trim(rs("ProvName"))%></TD>
<TD><%=FormatDate(rs("AppSDate"))%></TD>
<TD><%=weekdayName(rs("DOW"),true)%></TD>
<TD><%=trim(rs("LocCity"))%></TD>
<TD><%=rs("Reason")%></TD>
<TD><%=rs("pt_id")%></TD>
<TD><%=rs("ptName")%></TD>
<TD><%=rs("Type")%></TD>
<TD><%=rs("PtHomePhone")%></TD>
<TD><%=rs("PtWorkPhone")%></TD>
<TD><%=rs("CancelReason")%></TD>
</TR>
<%
rs.MoveNext
Loop
rs.Close
set rs = Nothing
%>
</TABLE>
</BODY>
</HTML>
解决方案
推荐阅读
- reactjs - React table - 单击列单元格时添加一个弹出框
- c# - 如何通过单击按钮运行 .exe 文件?
- docker - 如何在docker中启动后立即使用容器退出?
- python - 使用 Python 诅咒在终端中显示彩色 ascii 艺术
- ruby-on-rails - AbstractController::DoubleRenderError(在此操作中多次调用渲染和/或重定向,而不是重复
- node.js - 为什么 Clarifai 无法使用 Clarifai 门户中生成的 API 密钥或个人访问令牌验证模型输出请求?
- arrays - 无法使用 strtok() 访问地址处的内存
- python - cvlib 对象检测空列表
- mysql - 如何自然排序“XY”字符串数据,首先按X,然后按Y?
- javascript - 如何使用 Jest 模拟 optimizelySDK.createInstance().onReady()?