Solved

Save Query as text

Posted on 2000-02-14
3
150 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
ID: 2518582
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
ID: 2518716
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
ID: 2519083
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
WAMP server installation, getting error popups, DLLs missing 5 81
WEB Farm 6 76
cookies analysis tools 2 100
app server have enough resources... 2 52
This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

828 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