Advertisement Jump to content
Sign in to follow this  

[web] Export Query Results to downloadable .CSV

This topic is 4885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey geniuses, Im working on an page, where (hopefully) a user can click a button/link, which will execute the query and save the results to a downloadable .CSV file, or directly to their PC. Is there an easy way for this to be done? It sounds like a pretty common-place task and being the inexperienced web developer that I am, I thought I would ask if anyone new how to go about this quickly and easily. If youd rather not go into it, but do know of some good online resources to visit, I would be just as obliged! Thanks in advance

Share this post

Link to post
Share on other sites
For anyone keeping score, Ive figured it out:
A nice explanation from the ever trusty W3schools

The answer lies within using a FileSystemObject;

After setting and opening the Oracle DB connection string, I loaded the data into a recordset (update) and looped through printing the query results:

Set Update=Conn.Execute(sqlText)

Set fs=Server.CreateObject("Scripting.FileSystemObject" )

set tfile = fs.CreateTextFile(Server.MapPath("Market_Extract.csv"))

Do Until Update.EOF
tfile.WriteLine (Update("NPA" ) & " ," & Update("NXX" ))

Hope this helps someone has to do this same task. Good luck!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!