如何将coldfusion10查询的结果导出到html?

时间:2014-02-17 01:56:10

标签: coldfusion coldfusion-10

如何将coldfusion10查询的结果导出为html? 用户当前正在上传带有狗的excel表,我需要将pitBullcheck查询的结果输出到html表,以显示其中包含pitbull的行。 Breed是excel表中的一栏。

<cffunction name="validateExcelSheet" access="public" output="yes" returnType="void" 
hint="check dogs">

    <cfspreadsheet
    action="read"
    src="#SESSION.theFile#"
    headerrow= "1"
    excludeHeaderRow = "true"
    query = "allData"
    rows = "1-#lastRow#" />


<cfscript>    
 pitBullcheck = new Query(
        sql ="SELECT * FROM allData where breed like 'Pit' ",
        dbtype = "query",
        allData = allData);
        pitBullresult = pitBullcheck.execute().getResult();
   </cfscript>

</cffunction>

1 个答案:

答案 0 :(得分:2)

<table>
<tr>
  <td>breed</td>
</tr>
<cfoutput query="pitBullresult">
  <tr>
    <td>#pitBullresult.breed#</td>
  </tr>
</cfoutput>
</table>

然后只需为查询中的每一列添加额外的<td>