Daniel Crichton said:
shank wrote on Wed, 11 Mar 2009 20:23:13 -0400:
All you've posted is the part of the code that's adds header. Where's the
code that generates the actual XLS file?
All we can do is guess. My guess is that you might be hitting the response
buffer limit. Are you using sending the data in chunks, or just all in one
go?
============================================
Here's the entire page.... I changed Response.Buffer = True, to False. The
script ran a long time, but failed to save the end result.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
If Session("Manuf") <> "" Then
varFilename = Replace(Session("Manuf")," ","_")
ElseIf Session("Label") <> "" Then
varFilename = Replace(Session("Label")," ","_")
End If
%>
<%
Server.ScriptTimeout=240
Response.Clear
Response.Buffer = False
Response.contenttype = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "filename=" & varFilename & ".xls"
%>
<%
If Session("Manuf") <> "" Then
varFilename = Session("Manuf")
ElseIf Session("Label") <> "" Then
varFilename = Session("Label")
End If
%>
<%
If Session("Manuf") <> "" Then
varManuf = Session("Manuf")
Else
varManuf = ""
End If
%>
<%
If Session("Label") <> "" Then
varLabel = Session("Label")
Else
varLabel = ""
End If
%>
<%
Compilation = ""
OrderNo = ""
%>
<%
Dim rsS__Label
rsS__Label = "%"
If (varLabel <> "") Then
rsS__Label = varLabel
End If
%>
<%
Dim rsS__Manuf
rsS__Manuf = "%"
If (varManuf <> "") Then
rsS__Manuf = varManuf
End If
%>
<%
Dim rsS
Dim rsS_cmd
Dim rsS_numRows
Set rsS_cmd = Server.CreateObject ("ADODB.Command")
rsS_cmd.ActiveConnection = MM_WSD_STRING
rsS_cmd.CommandText = "{call WSD_admin.stp_WSD_Excel_Label_or_Manuf(?,?)}"
rsS_cmd.Prepared = true
rsS_cmd.Parameters.Append rsS_cmd.CreateParameter("param1", 200, 1, 255,
rsS__Label) ' adVarChar
rsS_cmd.Parameters.Append rsS_cmd.CreateParameter("param2", 200, 1, 255,
rsS__Manuf) ' adVarChar
Set rsS = rsS_cmd.Execute
rsS_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = -1
Repeat1__index = 0
rsS_numRows = rsS_numRows + Repeat1__numRows
%>
<html>
<head>
<title>Create an Excel Spreadsheet</title>
</head>
<body>
<table border="1">
<tr>
<%
'Loop through each Field, printing out the Field Names
For i = 0 to rsS.fields.count - 1
%>
<td><%=rsS(i).name%></td>
<% Next %>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsS.EOF))
%>
<tr>
<td><%=(rsS.Fields.Item("Category").Value)%></td>
<td><%=(rsS.Fields.Item("OrderNo").Value)%></td>
<td><%=(rsS.Fields.Item("ManCode").Value)%></td>
<td><%=(rsS.Fields.Item("Descrip").Value)%></td>
<td><%=(rsS.Fields.Item("Title").Value)%></td>
<td><%=(rsS.Fields.Item("Artist").Value)%></td>
<td><%=(rsS.Fields.Item("SortKey").Value)%></td>
<td><%=(rsS.Fields.Item("Label").Value)%></td>
<td><%=(rsS.Fields.Item("Manuf").Value)%></td>
<td><%=(rsS.Fields.Item("TypeProduct").Value)%></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsS.MoveNext()
Wend
%>
</table>
</body>
</html>
<%
rsS.Close()
Set rsS = Nothing
%>
thanks