SQL ColdFusion Get id from database and than update a row with form field value

馋奶兔 提交于 2019-12-11 12:31:58

问题


I have a query that needs to update What_name with whatever I type in the form. This is a snippet of my code:

<cfelseif ARGUMENTS.myForm.Submit EQ "Update_what">
    <cfquery name="LOCAL.myURL" datasource="#SERVER.cfc.core.getDSN()#">
        SELECT What_name 
        from logboek.tbl_What 
        WHERE What_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.myForm.What_name#" />
    </cfquery>
    <cfif LOCAL.myURL.RecordCount eq 1>
        <cfreturn VARIABLES.Error.myReturn />   
    <cfelse>
        <cfquery name="LOCAL.myURL" datasource="#SERVER.cfc.core.getDSN()#">
            UPDATE tbl_What
            SET What_name=<cfqueryparam cfsqltype="cf_sql_varchar" value="#ARGUMENTS.myForm.Update_what#" />;
            WHERE What_name=<cfqueryparam value="#ARGUMENTS.myForm.What_name#" cfsqltype="cf_sql_varchar"> 
        </cfquery>
    </cfif>

I am getting the following error:

Message
string Component [cms_core.com.blog.blog] has no accessible Member with name [ERROR]

Is there something wrong with my query?

来源:https://stackoverflow.com/questions/34874720/sql-coldfusion-get-id-from-database-and-than-update-a-row-with-form-field-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!