Link to home
Start Free TrialLog in
Avatar of OneEyedBandit
OneEyedBandit

asked on

Retrive info and save as text file (FSO)

Hi!
Basic Outline of what i'm trying to do.

I need to be able to retrive information from a SQL 2000 DB and then give an option to be able to save the field values as a Text file.

I can connect to my db fine I am just unsure of using the FSO commands.

If theres anything you want me to post then let me know and i'll do so.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of ddrudik
ddrudik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of OneEyedBandit
OneEyedBandit

ASKER

Hi thanks for your quick response.

I don't think thats what i'm going to need, but I think its my fault for not explaining my situation better!! i'll try to be more precise.
I need to query my database for a specific record which the (for examples sake) the admin chooses. He would type ths id of thread he wants to see and then once that is processed a pop up comes up saying download xxxx.txt

Maybe a way around this is to create a stored procedure in SQL that saves the specific data as a text file. and then when im in asp I could call that stored procedure and add my variable within that. Process that and on the next page I call that file that i've just saved as a text file?

Is that a good way to do something like that or have i lost the plot?!
>He would type ths id of thread he wants to see and then once that is processed a pop up comes up saying download xxxx.txt
The code I provided would be the ASP code required if you wanted to create a file on-the-fly and present it to the user as a file to be downloaded to their PC.

Is it that you want to create text files on the server that you can then later link to?

If so:
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = server.CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(server.mappath(".") & "\yourfilename.txt",ForWriting,true)
objFile.Write(str)

Then later, your textbox would have an action to call window.open with URL built on the URL of the directory + filename from the textbox.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Has this issue been resolved?
Forced accept.

Computer101
EE Admin