我正在输出一个查询,但需要指定结果的第一行。我正在使用 QueryAddRow() 添加行并使用 QuerySetCell() 设置值。我可以很好地创建行,我可以很好地将内容添加到该行。如果我离开 QuerySetCell() 的行号参数,那么它在输出时作为查询的最后一个结果都很好。但是,我需要它作为查询的第一行,但是当我尝试使用 QuerySetCell 设置行属性时,它只会覆盖我的查询中返回的第一行(即我的 QueryAddRow() 替换我的查询中的第一条记录)。我目前拥有的是从 recordCount 设置一个变量并安排输出,但必须有一种非常简单的方法来做到这一点,而我只是没有得到。此代码将行值设置为 1,但会覆盖查询返回的第一行。
<cfquery name="qxLookup" datasource="#application.datasource#">
SELECT xID, xName, execution
FROM table
</cfquery>
<cfset QueryAddRow(qxLookup)/>
<cfset QuerySetCell(qxLookup, "xID","0",1)/>
<cfset QuerySetCell(qxLookup, "xName","Delete",1)/>
<cfset QuerySetCell(qxLookup, "execution", "Select this to delete",1)/>
<cfoutput query="qxLookup">
<tr>
<td>
<a href="##" onclick="javascript:ColdFusion.navigate('xSelect/x.cfm?xNameVar=#url.xNameVar#&xID=#qxLookup.xID#&xName=#URLEncodedFormat(qxLookup.xName)#', '#xNameVar#');ColdFusion.Window.hide('#url.window#')">#qxLookup.xName#</a>
</td>
<td>#qxLookup.execution#</td>
</tr>
</cfoutput>
谢谢你的帮助。