If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Error exporting to Excel

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-09-09, 22:48
ataxia1 ataxia1 is offline
Registered User
 
Join Date: Apr 2004
Posts: 11
Error exporting to Excel

Trying to export data to Excel. It's probably been four years since I've used straight ASP (vs. .NET) so I'm a bit rusty. Found several articles and forum posts with people having this same error, but no resolution on any of them.

Clicking the link to my ASP file pops up a download box, then immediately an error box that says the site cannot be found. If I remove the Excel headers, the page displays perfectly--an unformatted table of my data.

Any suggestions would be great.

Thanks

Code:
<%
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=userlist.xls"
%>
<table>
<%
Dim Database, i
Set Database = ConnectDB()
Dim rsUserEmails, UserEmails
UserEmails = Empty
Set rsUserEmails = Database.Execute("SELECT * FROM Users")
Do Until rsUserEmails.EOF
%>
	<tr>
                      ... data here ...
	</tr>
	<%
	rsUserEmails.MoveNext
Loop
rsUserEmails.Close
Set rsUserEmails = Nothing
%>
</table>
<%
Database.Close
Response.End
%>
Reply With Quote
  #2 (permalink)  
Old 10-09-09, 22:54
ataxia1 ataxia1 is offline
Registered User
 
Join Date: Apr 2004
Posts: 11
Nevermind..

Knocked out my database include file when clearing out some of the header.

Thanks for taking a look.

Works like a champ now.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On