I am trying to export a recordset to Excel, but it does not seem to work on production servers. However, this seems to work on my development workstation. I'm curious that I am responding to a server related problem, but I have other applications that can only export fines using the same exact code, as well as the same code that was configured.
<%@ Language=VBScript %>
<%Response.expires = -1%>
<%response.buffer = true%>
<%
Dim today
today = "_" + Replace(Date,"/","") + "_" + Replace(Time(),":", "")
Response.Charset = "ANSI"
Response.ContentType = "application/octet-stream"
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=List" + today + ".xls"
Response.ContentType = "application/download"
set Cnn = server.CreateObject("ADODB.connection")
Cnn.ConnectionString = Application("Cnn_ConnectionString")
Cnn.open
set rs1 = server.CreateObject("ADODB.Recordset")
SQLCollections = "Sp_MysProc @Param1=" & Session("var1")
rs1.open SQLCollections,cnn
%>
<html>
<body>
<table>
<tr>
<td>Number</td>
<td>Name</td>
</tr>
<%if not rs.eof then
do while not rs.eof %>
<tr>
<td><%=rs("Number") %></td>
<td><%=rs("Name") %></td>
</tr>
<%
rs.MoveNext
Loop
rs.Close
set rs = Nothing
End if
%>
</table>
</body>
</html>
Again, this works from my car. But when I do this from production, he gives me the following message:
Internet Explorer cannot download MyFile.asp from www.mydomain.com
Internet Explorer was unable to open this website. The requested site is either unavailable or cannot be found. Please try again later.
HTML , .. Excel?
Edit:
.
, ( ).
, If Not EOF. , , . . - desipte, , .
2
(oops!), . Office 2007. - , , . Office 2000. jsut HTML, .
Might Office 2000 ?