We help IT Professionals succeed at work.

Retrive info and save as text file (FSO)

OneEyedBandit
on
726 Views
Last Modified: 2012-06-21
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
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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?!
CERTIFIED EXPERT

Commented:
>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.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
Has this issue been resolved?
Forced accept.

Computer101
EE Admin
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.