Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to save recordset data to Txt/Excel/Access?

Posted on 2000-03-29
2
Medium Priority
?
229 Views
Last Modified: 2008-01-09
In Asp,I want to save the opened recordset data to text file,Excel or Access format.How can I do that?
0
Comment
Question by:huangjian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
ruperts earned 100 total points
ID: 2666399
0
 
LVL 10

Expert Comment

by:makerp
ID: 2666429
you will need to do your query and then open a text file , loop through your resultset and print each filed to the text file in the desired format

i.e

Set Con = Server.CreateObject("ADODB.Connection")

con.Open "your_dsn"

Set rs = Con.Execute("SELECT * FROM mars")


Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("c:\testfile.txt", True)
 
DO UNTIL rs.EOF
     MyFile.WriteLine(rs("field_one")&","&rs("field_two")&","&rs("field_three"))
    rs.MoveNext
LOOP

MyFile.Close

wrap your fileds in "" for text and use commas to separate fields and you will be able to load it into excel

i.e.


"paul",2,"address",.......
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question