please disregard this post. I have made a clearer example of my problem here: Error with CFLoop When Entries Are Missing
下面是CFLoop编码。
<cfset data = queryNew("sid,firstname,lastname,age","integer,varchar,varchar,integer")>
<cfloop index="x" from="1" to="50">
<cfset queryAddRow(data)>
<cfset querySetCell(data,"sid",x)>
<cfset querySetCell(data,"firstname","#first[x]#")>
<cfset querySetCell(data,"lastname","#last[x]#")>
<cfset querySetCell(data,"age","#studentage[x]#")>
</cfloop>
<cfoutput query="data">
#sid# - #firstnamet# #lastname# - #age#<br />
</cfoutput>
正在从外部数据来源中提取<代码>X>。 注:CFLoop有50个条目。
当有数据时,该守则便能很好地发挥作用。 然而,如果缺乏数据,则代码便会中断。 也就是说,如果第11号条目中有一个名字列在<代码>第1[x]上,那么我就按照<代码>的行文出现错误,首先没有界定。 错误出现在第5行代码>上。
(line 5 is the entry for first name).
当出现这种情况时,我要从我的结果中删除第11条(以及造成错误的所有其他条目),防止出现错误。 我如何能够这样做?
Clarification: Please assume the data is defined. It gets a bit hairy since I am using an external datasource. But what I am saying is that Entries 1 to 10 show up. When its entry 11 s turn, that s when the error comes up.