简体   繁体   中英

Display query result and export to excel using classic asp

I'm working on a small project regarding classic ASP and sql server.

I have a drop down menu where the user can enter name, last name, etc. and it will create a query based on that and create a table displaying the result.

What I want to add is the option to export to excel after the table is created. I've looked at other tutorials but they all use the simple Select * from table rather than a query based on user input.

can anyone help on this?

add

response.contenttype ="Application/vnd.excel"
response.addheader "Content-Disposition", "attachment; filename=excelDatei.xls"

and the browser opens the save/open/cancel dialog...

is that what you want?

Solved my question which dealt more with how to use this code. What I ended up doing is storing the SQL query in a session variable and creating a link to a new ASP page that will connect to the database, create the Excel object, and output to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM