Link to home
Start Free TrialLog in
Avatar of techman36
techman36

asked on

writing a recordset to a text file

I want to write data to a text file. I want to be able to control how the data will look in the text file so I was thinking of using recorddset fields and putting it all in one CF variable string and use cffile to output that one variable. I guess I want to know how to put all my data from my query into a single string variable.
Avatar of _agx_
_agx_
Flag of United States of America image

You may wish to look at the last example here (see "to write all at once")
https://www.experts-exchange.com/questions/20752794/How-can-I-write-a-CF-query-to-a-Text-file.html?qid=20752794
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
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 singi007
singi007

You can use the following:

 <cfsavecontent variable="contentvar">
 <cfoutput>text
 text and more text. and formatting
 </cfoutput>
 </cfsavecontent>
 
<cffile action = "write"
  file = "c:\output\"
  output = "#contentvar#"
  mode = "777"
  attributes="normal">