如何在cfml中显示带撇号的列名

问题描述 投票:0回答:1
html coldfusion cfml
1个回答
0
投票

您似乎正在尝试在 ColdFusion 标记语言 (CFML) 页面中显示数据库查询结果中名为“isNotBM'd”的列的值。但是,由于其中包含撇号,您在显示此列名称时遇到了问题。

要在 CFML 页面中显示该列的值,您需要正确处理带有撇号的列名称。实现此目的的一种方法是使用关联数组表示法访问列。以下是修改代码的方法:

<cfquery name="get" datasource="Maste">
    exec DB01.Log.Bmarking_History
</cfquery>

<!--- Loop through the query result to display the values --->
<cfoutput query="get">
    <tr>
        <!--- Access the column using associative array notation --->
        <td>#get["isNotBM'd"][currentRow]#</td>
    </tr>
</cfoutput>

在此代码中:

我使用 get["isNotBM'd"][currentRow] 来访问查询结果中每一行的“isNotBM'd”列的值。 currentRow 是 CFML 中的一个特殊变量,表示查询循环中正在处理的当前行。 这应该允许您在 CFML 页面上正确显示“isNotBM'd”列的值。

© www.soinside.com 2019 - 2024. All rights reserved.