Solved

Save Query as text

Posted on 2000-02-14
3
152 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
[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
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

Save the day with this special offer from ATEN!

Save 30% on the CV211 using promo code EXPERTS30 now through April 30th. The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 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