Coldfusion Application.cfc

dra*_*354 0 coldfusion application.cfc

这可能是一个愚蠢的问题,但是当我的数据源位于cfm页面时,它可以正常工作,但是当我将数据源放在我的application.cfc中时,它会出错.

来自CFM文件的代码

<cfquery name = "getlist" datasource="jeb48_shoppingcart">
 SELECT ProductID, ProductName, ProductQty, ProductPrice, ProductDescription
 FROM Products;
</cfquery>
Run Code Online (Sandbox Code Playgroud)

来自CFC的代码

<cfcomponent> 
   <cfset This.name = "TestApplication"> 
   <cfset This.clientStorage = "jeb48_northwind"> 
   <cfset This.clientmanagement="True"> 
   <cfset This.loginstorage="Session"> 
   <cfset This.sessionmanagement="True"> 
   <cfset This.sessiontimeout="#createtimespan(0,0,10,0)#"> 
   <cfset This.applicationtimeout="#createtimespan(5,0,0,0)#"> 
</cfcomponent>
Run Code Online (Sandbox Code Playgroud)

Ant*_*ony 9

您的Application.cfc未正确设置数据源.

clientstorage所使用的client变量- 阅读更多有关在这里

datasource 用于cfquery数据源:

<cfset this.datasource="cfartgallery">

您可以在这里阅读有关该datasource物业的更多信息