Exporting Query Results to Excel

We recently moved a Classic ASP app to a new server that is running IE8, IIS6 but the code below that exports the html to excel has stopped working.  

Does anyone know of a workaround?

Response.ContentType = "application/vnd.xls"
jmpattonAsked:
Who is Participating?
 
Big MontyConnect With a Mentor Senior Web Developer / CEO of ExchangeTree.org Commented:
try adding this to after the ContentType line:

Response.addHeader "content-disposition","attachment;filename=yourname.xls"
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
try

Response.ContentType = "application/vnd.ms-excel"
0
 
jmpattonAuthor Commented:
No i tried that first and it didnt work.  Here is a stupid question, but does the MS Office suite have to be installed on the server for this to work?
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Yes it does
0
 
jmpattonAuthor Commented:
Thanks, I added excel to the server and no longer get the error, however, a "Open/Save" dialog box now opens up, but it will not open.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
are you getting any kind of error when you try to open it?
0
 
jmpattonAuthor Commented:
No, I hit the open button and it does nothing.  If I hit the Save button, it tries to save the page in ".asp" format
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
what version of excel are you using? its hard to diagnose the issue without seeing more of the code
0
 
jmpattonAuthor Commented:
Excel 2010.

Here is my code below.  I have an asp page that does a query and returns the results into an html table to the user.  If the user would like an excel format, they click a link at the top of the page and they are sent to a new page running the same query and returning the same results in html format just with the excel code below at the top of the page.

<%

Response.Buffer = true
Response.ContentType = "application/vnd.ms-excel"  
      
      If Request.QueryString("SQLType") <> "" Then
            sSQLType = Request.QueryString("SQLType")
      End If
      
      If Session("sSQL") <> "" Then
      
            oRs.Open Session("sSQL"), oConn
      
      Else
            
            Response.Redirect("oracle_query.asp")
            
      End If  
%>
0
 
jmpattonAuthor Commented:
Great that worked.  Thanks so much for working with me
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
my pleasure, glad I could help :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.