Friday, May 27, 2005

Download From Database To Excel

Ever wonder how to export data from a database and have it open in Excel on the users desktop?

Use this code to get you started.

<cfheader name="Expires" value="#Now()#">
<cfcontent type="application/vnd.ms-excel">
<html><head><title>Untitled</title></head>
<body>
<cfquery datasource="investigatorportal" name="getcodedesc">
select * from code_desc
</cfquery>

<table>
<cfoutput query="getcodedesc">
<tr>
<td>#getcodedesc.code_desc#</td>
</tr>
</cfoutput>
</table>

</body>
</html>

0 Comments:

Post a Comment

<< Home