469,336 Members | 6,029 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

Can output as HTML but not as XLS

Hi all!

I haven't being doing that much in ASP, but I have to create this:
It has to read out data from some DB to excel.

The following (corrected) code works if just it outputs as html, once
the Response.ContentType is excel. then it offers to open/save the
file, and stops - file not found - what do I do wrong?

BR
Sonnich

<%
'Change HTML header to specify Excel's MIME content type.
'Response.Buffer = TRUE
' Response.ContentType = "application/vnd.ms-excel"
%>
<HTML>
<HEAD>
<TITLE>Excel</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<form name="ExcelForm">
<TABLE>
<TR>
<TD colspan=3>Created: <%=cstr(now)%></TD>
</TR>
</table>

<TABLE border="1">
<tr><td><b>Code</b></td><td><b>Description 1</b></td><td><b>Description
2</b></td><td><b>Qty</b></td><td><b>Price</b></td><td><b>Total</b></td></tr>
<%

dim rsTree
set rsTree = server.createobject("adodb.recordset")
rsTree.activeconnection = DSN_Oracle

dim txt
txt = "select blah!"
rsTree.Open(txt)

do while not rsTree.eof
taso=""
for J=1 to cint(field_value(2,rsTree))
taso = taso & "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
next

'*********************
response.write("<tr><td>" + taso + field_value(0,rsTree) +
"</td><td>" + _
field_value(1,rsTree) + "</td><td>" + field_value(6,rsTree) +
"</td><td>" + field_value(5,rsTree) + "</td><td>a</td><td>b</td></tr>")
response.write(chr(10))

rsTree.movenext
loop
rsTree.close
%>

</TABLE>
</form>
</BODY>
</HTML>

Jul 31 '06 #1
0 1036

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Samantha | last post: by
2 posts views Thread by Bill Sneddon | last post: by
1 post views Thread by Lisa | last post: by
3 posts views Thread by johkar | last post: by
2 posts views Thread by Taare | last post: by
5 posts views Thread by Poster | last post: by
6 posts views Thread by Wescotte | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.