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 June 20th, 2005, 11:59 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default create xsl file in c directory

Hi,
I use this code to create xsl file from one of my tables in the db.
set fso = createobject("scripting.filesystemobject")
Set act = fso.CreateTextFile(server.mappath("/" & strfilename & ".xls"), True)

I use this code on my webserver on internet.
It now creates the file in the root directory using server.mappath
No how can I change this code so it referes to the c dirctory of my hard drive

 
Old June 21st, 2005, 06:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Set act = fso.CreateTextFile("c:\" & strfilename & ".xls", True)

This should create it as expected.

_________________________
- Vijay G
Strive for Perfection
 
Old June 21st, 2005, 04:52 PM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
when I run the page,the page stops working
what can the problem be
here are the codes
<%

intEventID=request.querystring("ID")
if intEventID="" or intEventID="0" or isNumeric(intEventID)=False then
response.end
end if

set rsEvent=server.createobject("adodb.recordset")
RsEvent.open "SELECT * FROM Events where EventRnd=" & intEventID,Conn,3,3

if rsEvent.eof then
response.write "This event does not exist"
response.end
end if
intID=rsEvent("EventID")
strEventName=rsEvent("event_name")
set fso = createobject("scripting.filesystemobject")
Set act = fso.CreateTextFile("c:\" & strEventName & ".xls", True)

Rs.open "select * from GuestList where EventID=" & intID,Conn,3,3

act.WriteLine "<html xmlns:x=""urn:schemas-microsoft-com:office:excel"">"
act.WriteLine "<head>"
act.WriteLine "<!--[if gte mso 9]><xml>"
act.WriteLine "<x:ExcelWorkbook>"
act.WriteLine "<x:ExcelWorksheets>"
act.WriteLine "<x:ExcelWorksheet>"
act.WriteLine "<x:Name>"& strfilename &"</x:Name>"
act.WriteLine "<x:WorksheetOptions>"
act.WriteLine "<x:Print>"
act.WriteLine "<x:ValidPrinterInfo/>"
act.WriteLine "</x:Print>"
act.WriteLine "</x:WorksheetOptions>"
act.WriteLine "</x:ExcelWorksheet>"
act.WriteLine "</x:ExcelWorksheets>"
act.WriteLine "</x:ExcelWorkbook>"
act.WriteLine "</xml>"
act.WriteLine "<![endif]--> "
act.WriteLine "</head>"
act.WriteLine "<body>"
act.WriteLine "<table>"

act.WriteLine "<tr>"
act.WriteLine "<td>"
act.WriteLine "Email"
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine "Attendance"
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine "Comments"
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine "Date_Replied"
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine "# of Guests"
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine "view Date"
act.WriteLine "</td>"


act.WriteLine "</tr>"

''''''''''''''''''''''''''''''''
do while not rs.eof
act.WriteLine "<tr>"

act.WriteLine "<td>"
act.WriteLine rs("Email")
act.WriteLine "</td>"


act.WriteLine "<td>"
act.WriteLine rs("attendance")
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine rs("comment")
act.WriteLine "</td>"


act.WriteLine "<td>"
act.WriteLine rs("date_replied")
act.WriteLine "</td>"


act.WriteLine "<td>"
act.WriteLine rs("guest_brings")
act.WriteLine "</td>"

act.WriteLine "<td>"
act.WriteLine rs("viewDate")
act.WriteLine "</td>"

rs.moveNext
loop
act.WriteLine "</table>"
act.WriteLine "</body>"
act.WriteLine "</html>"
act.close

%>
<table class=subnav align=center>
    <tr>
    <td>&nbsp;</td>
    <td>Excel file for Guests created successfully</td>
    </tr>
</table>
</td>
            </tr>
        </table>
    </div>
</tr>
</table>
<%

    rs.close
    set rs=nothing
    Conn.close
    set Conn=nothing

%>






Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot create record, directory exist auxiora_nemesis PHP Databases 1 April 13th, 2008 11:04 PM
Create generic XSL Template to create table Venkatachalapathy XSLT 5 March 11th, 2008 07:49 AM
How to Create new folder(directory) in Srever ? Raam ASP.NET 2.0 Professional 1 May 10th, 2006 12:48 PM
check for directory, or create new if not found amerk20 VB How-To 1 April 8th, 2005 12:18 PM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





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