在我的CF組件中,我試圖過濾來自用戶輸入(getSearchString)的數據並運行代碼,我遇到了WHERE函數的問題。可以建議什麼是正確的方法?其中參數
<cffunction name="getParks" access="remote" returntype="struct">
<cfargument name="page" required="true" />
<cfargument name="pageSize" required="true" />
<cfargument name="gridsortcolumn" required="true" />
<cfargument name="gridsortdirection" required="true" />
<cfargument name="getSearchString" default="" />
<cfif arguments.gridsortcolumn eq "">
<cfset arguments.gridsortcolumn = "parkName" />
<cfset arguments.gridsortdirection = "asc" />
</cfif>
<cfquery name="parks" datasource="cfdocexamples">
select parkName, parkType, city, state
from parks
where <cfqueryPARAM value = "#getSearchString#" CFSQLType = "CF_SQL_VARCHAR">
order by #arguments.gridsortcolumn# #arguments.gridsortdirection#
</cfquery>
<cfreturn queryconvertforgrid(parks, page, pagesize) />
它工作但CFGrid運行代碼時不加載任何數據。 – proyb2 2010-04-02 12:03:56
抱歉,它與該參數周圍的%..%一起工作 – proyb2 2010-04-02 12:06:46