Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 26th, 2014, 04:32 PM
Authorized User
Join Date: Apr 2006
Posts: 31
Thanks: 1
Thanked 0 Times in 0 Posts
Default I use "application/vnd.ms-excel" to export

I'm a newbie at this and I can figure most things out, but this one has me stumped. I don't know enough about it to even ask the question correctly.

I'm exporting an 'In-service Classes' database to excel.

This is my export coding:
<%@ Language=VBScript %>
dim Cn,Rs
set Cn=server.createobject("ADODB.connection")
set Rs=server.createobject("ADODB.recordset")
Cn.open "provider=[private]; DRIVER={SQL Server}; SERVER=[private]; DATABASE=[private]; UID=[private]; PWD=[private];"
Rs.open "select * from [private] WHERE status is null or status <>'D' Order by Name",Cn,1,3
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=YearToDateExport.xls"
if Rs.eof <> true then
response.write "<table border=1>"
response.write("<tr><td>Name</td><td>Department</td><td>Extension</td><td>Class Taken</td><td>Class Desired</td></tr>")

while not Rs.eof
response.write "<tr><td>" & Rs.fields("Name") & "</td><td>" & Rs.fields("Division") & "</td><td>" & Rs.fields("Extension") & "</td><td>" & Rs.fields("ClassMonth") & "</td><td>" & Rs.fields("ClassDesired") & "</td></tr>"

response.write "</table>"
end if
set rs=nothing

This works fine. But my "ClassMonth" has many months in it and I would like the spreadsheet to not show 'Jan', 'Feb', etc. I want it to show 'First Aid', 'CPR for Beginners', etc.

Is there a way to do this? IF THEN statements don't work, and I'm not a VBScript person. If I knew where to look, or even how to phrase my query I could find it and figure it out, so any help would be great.

Thanks in advance

Similar Threads
Thread Thread Starter Forum Replies Last Post
Internet Explorer, Right-click - "Export to Microsoft Excel" on a Gridview. WebDev123 ASP.NET 4 General Discussion 1 January 18th, 2013 01:23 PM
Export to Excel Error "HRESULT : 0x800AC472" Michael YoeH ASP.NET 3.5 Professionals 0 July 14th, 2009 03:31 AM
When I used "application/vnd.ms-excel" to export t miaomiaoga Classic ASP Basics 1 October 20th, 2007 04:00 AM
application/vnd.ms-excel Help! drumph Classic ASP Components 3 May 31st, 2007 06:02 AM
When I used "application/vnd.ms-excel" to export t miaomiaoga Classic ASP Databases 0 January 28th, 2005 04:12 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.