Solved

Save Query as text

Posted on 2000-02-14
3
144 Views
Last Modified: 2013-12-24
I have a chart displayed on a page. The chart is drawn using criteria from a form that the Customer completes. The data for the chart is kept in a SQL Server 7 db. How do I save the results of the query as a file and allow the user to download it?
0
Comment
Question by:cb1
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
nathans earned 100 total points
Comment Utility
Here is a sample on how it can be done.  Of course you need to change the query information.  If you need more help comment and I will try and help you.

<html>
<head>
      <title>Untitled</title>
</head>

<body>


<!--- This is just an example --->

<cfquery name="SampleQuery" datasource="nsnd">
select             *
from                   users
</cfquery>

<cfset loginname ="blank">
<cfoutput query="SampleQuery">
<cfset ListName = "#loginname#">

<cffile action="append" file="D:\inetpub\wwwroot\test\file.txt"  output="#listname#">

</cfoutput>
<a href="/test/file.txt">File</a>

</body>
</html>
0
 

Author Comment

by:cb1
Comment Utility
Can you explain the <cfset loginname ="blank"> and how would I allow the user to download the results as opposed to showing them on screen.

Thanks
0
 
LVL 5

Expert Comment

by:nathans
Comment Utility
1. You don't need the  <cfset loginname ="blank">  sorry I modified some code I have that works... and I needed it for a list.  I was creating a comma delimited list and I started with the first one as blank.

2.Since it is text it really depends on how you want the user to do it.

  A) you can name it something other then .txt like .dat or
  B) you can tell them how to right click and download the file.  

Not sure which works best for your situation but that is some of the choices I would be looking at.


Nathan Stanford
What else can I help you with?
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now