Solved

Display query result and export to excel using classic asp

Posted on 2011-09-12
5
279 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 32

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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/…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now