本文介绍了我可以在ColdFusion中按索引获取查询吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在ColdFusion Query对象中获取特定的行,而不循环。

I want to get a specific row in a ColdFusion Query object without looping over it.

我想这样做:

<cfquery name="QueryName" datasource="ds">
SELECT *
FROM    tablename
</cfquery>

<cfset x = QueryName[5]>

但是它给我一个错误,说查询不能由5索引。我知道这个查询中有超过5条记录。

But it's giving me an error saying that the query isn't indexable by "5". I know for a fact that there are more than 5 records in this query.

推荐答案

你不能得到一行。您必须获取特定列。

You can't get a row. You have to get a specific column.

<cfset x = QueryName.columnName[5]>

这篇关于我可以在ColdFusion中按索引获取查询吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 17:25
查看更多