Solved

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

Posted on 2000-03-29
2
227 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 25 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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