SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 10th, 2003, 10:43 AM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 6 m 22 sec
Reputation Power: 76
possible fso problem

I have an asp script meant to take the first record from my database and write it to a csv file on the server. The code meant to do this is:
Code:
SQL = "SELECT TOP 1 * FROM UserRequest ORDER BY RecordID DESC"

	Set aRS = Conn.Execute (SQL)
	dim filesavepath
	Dim F, Head

	'This is where you want to Write the CSV File. This example is a physical path.
	filesavepath = "e:\prod\intranet\www-gs\pdh\insertData.csv"

	set FSO = Server.CreateObject("scripting.FileSystemObject")
	set csvfile = fso.CreateTextFile(filesavepath, true)

	'This loops through the database and then writes into CSV format.
	'Head is the Field names.
	'Body are the actual records

	For Each F In aRS.Fields
		Head = Head & ", " & F.Name
	Next
	
	Head = Mid(Head,3) & vbCrLf
	Body = aRS.GetString(,,", ",vbCrLf,"")
	csvfile.WriteLine(Head)
	csvfile.WriteLine(Body)

	csvfile.Close

I do make the connection object earlier in the code, and it works. (That is, it does the stuff to the database that preceedes this code.) When I run the whole page, there are no errors, and everything else works correctly, but the csv file is not generated, which is the point of this code. Are there any problems with my code here, or might the permissions be set wrong on the server? Any help is much appreciated.
__________________
--Dave--

U2kgSG9jIExlZ2VyZSBTY2lzLCBOaW1pdW0gRXJ1ZGl0aW9uaXMgSGFiZXM=

Reply With Quote
  #2  
Old July 10th, 2003, 08:22 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
intuition

set csvfile = fso.CreateTextFile(filesavepath, true)

you're code looks right, right here is where i've run into problems before, this line creates the text file, so if it bombs, it bombs and the text file is still created as long as this line just succeeds, it's just blank i think.

maybe you haven't set the iuser to be allowed to write to this directory

or maybe your path is wrong? I really recommend using mappath to avoid virtual and absolute path errors.

why arn't you getting error messages too? if the createastextfile line is the problem usually it tells you (makes debugging MUCH easier), have you enabled it to show debug errors? you can in the folder the asp file resides.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > possible fso problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway