Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 20th, 2005, 11:59 PM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old June 21st, 2005, 06:32 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
  #3 (permalink)  
Old June 21st, 2005, 04:52 PM
Friend of Wrox
 
Join Date: May 2005
Location: , , .
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

%>

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:46 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.