asp to excel
Hi, I'm trying to output my query and get it to go to an excel file, but it simply outputs the web table, with no error. I am specifying Response.ContentType = "application/vnd.ms-excel" in the code PRIOR to <html>...
Any suggestions?
<%
Set db = Server.CreateObject("ADODB.Connection")
db.ConnectionString = "DSN=workout_CostSaving.mdb"
db.Open
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from the_bird "
rs.Open sql, db
Response.ContentType = "application/vnd.ms-excel"
%>
<html>
<table>
<tr>
<%
' Loop through each Field, printing out the Field Names
For i = 0 to rs.fields.count - 1
%>
<td><% = rs(i).name %></td>
<% next %>
</tr>
<%
while not rs.eof
%>
<tr>
<% For i = 0 to rs.fields.count - 1
%>
<TD VALIGN=TOP><% = rs(i) %></TD>
<% Next %>
</TR>
<%
rs.MoveNext
wend
rs.Close
db.close
%>
|