Solved

Display query result and export to excel using classic asp

Posted on 2011-09-12
5
284 Views
Last Modified: 2012-05-12
I want to give the option to export results from a query to excel after displaying the query results.

I know how to do it one separately, and I am assuming that I would have to either put the results of the query in a query string or a session and pass it to the export.asp page.
0
Comment
Question by:rschooff
5 Comments
 
LVL 33

Expert Comment

by:Big Monty
ID: 36525975
0
 
LVL 9

Expert Comment

by:djpazza
ID: 36529068
The easiest way is to add the attached code to the page that you want to output to excel.  So passing you query to the export page which you would design in an excel like simple format.  With the attached code the page result will open in excel.
<%
'Set content type to Excel so page will open in Excel
	Response.ContentType = "application/vnd.ms-excel"
%>

Open in new window

0
 

Author Comment

by:rschooff
ID: 36531293
I found my answer here. I already knew how to make it go straight to Excel, but I wanted the results listed first and then they could decide if they want to export to Excel.

This solution hides the sql string in a form and then submits it to a page that then has the code as above. ie set content type

http://bytes.com/topic/asp-classic/insights/706819-how-export-your-displayed-data-excel
0
 

Accepted Solution

by:
ee_auto earned 0 total points
ID: 37230420
Question PAQ'd and stored in the solution database.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server Timeout with Loop 6 59
File download script VBSCRIPT fail on download PPT files 2 70
Issues with Insert statement 12 31
Html Table Looping (part 2) 5 35
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question