
October 26th, 2003, 09:00 AM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 5
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
You might be able to try this. This will display a query in excel.
<cfquery name="test" datasource="yourdsn">
SELECT first_name, last_name, age FROM students
</cfquery>
<cfif test.recordcount GTE 66000>
Too many records! <cfabort>
</cfif>
<cffile action="write" file="c:\inetpub\wwwroot\coldfusion\newrockenbach\codesnippet\data.cfm" output="
<cfcontent type='application/vnd.ms-excel'>
<table border='1'>
<tr>
<td>First Name</td>
<td>Last Name</td>
<td>Age</td>
</tr> " addnewline="Yes">
<cfoutput>
<cfloop query="test">
<cffile action="append" file="c:\inetpub\wwwroot\coldfusion\newrockenbach\codesnippet\data.cfm" output=" <tr>
<td>#trim(first_name)#</td>
<td>#trim(last_name)#</td>
<td>#trim(age)#</td>
</tr> " addnewline="Yes">
</cfloop>
</cfoutput>
<cffile action="append" file="c:\inetpub\wwwroot\coldfusion\newrockenbach\codesnippet\data.cfm" output="</table> " addnewline="Yes">
<div align="center">
<b>Your report has been generated...<br></b>
<a href="data.cfm">Click here to complete the download</a>
</div>
|