ColdFusion数据库更新错误

发布于 2024-12-09 20:41:21 字数 11496 浏览 0 评论 0原文

我收到此错误(请参阅下面的错误代码):

Error Executing Database Query.

Syntax error in UPDATE statement.

The error occurred in 

C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 54
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 53
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 1
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 54
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 53
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 1
52 :    </CFCASE>
53 :    <CFCASE VALUE="update">
54 :        <CFUPDATE TABLENAME="Customer" DATASOURCE="#client.datasource#">
55 :        <CFQUERY NAME="GetCustomer" DATASOURCE="#client.datasource#">
56 :            Select * From Customer

代码示例:

第 1 行到第 4 行如下:

<CFQUERY Name="GetFaxFrequency" datasource="#client.datasource#">
    Select * From Fax_Frequency
    Order By Fax_Frequency_Id
</CFQUERY>

从此代码派生的错误代码:

<TR><TD VALIGN="top">
<CFSET mode_list = "add,edit,update,invalid">
    <CFIF ListContainsNoCase(mode_list, url.mode)>
    <CFIF url.mode is "invalid">
        <TABLE ALIGN="center" CELLPADDING="2" CELLSPACING="0" BGCOLOR="Red">
        <TR><TH COLSPAN="4">Current Customer Record</TH></TR>
    <CFELSE>
        <TABLE ALIGN="center" CELLPADDING="2" CELLSPACING="0">
        <TR><TH COLSPAN="4">Edit Customer</TH></TR>
    </CFIF>
    <CFFORM ACTION="AdminCustomer.cfm?mode=update" METHOD="post" NAME="addCustomer">


    <CFOUTPUT>          
        <TR><TD>First Name</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.First_Name#" MAXLENGTH="50" NAME="First_Name" REQUIRED="Yes" MESSAGE="Enter First Name">
        </TD><TD>Last Name</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Last_Name#" MAXLENGTH="50" NAME="Last_Name" REQUIRED="Yes" MESSAGE="Enter Last Name">
        </TD></TR>

        <TR><TD>Company</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Company_Name#" MAXLENGTH="50" NAME="Company_Name" REQUIRED="Yes" MESSAGE="Enter Company Name">
        </TD><TD>Fax ( 4153446789 )</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Fax_Number#" MAXLENGTH="11" NAME="Fax_Number" REQUIRED="Yes" VALIDATE="integer" RANGE="0000000000,19999999999" MESSAGE="Enter a proper fax number ( 14153768888 )">
        </TD></TR>

        <TR><TD>User Name</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.User_Name#" MAXLENGTH="50" NAME="User_Name" REQUIRED="Yes" MESSAGE="Enter User Name">
        </TD><TD>Password</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Password#" MAXLENGTH="50" NAME="Password" REQUIRED="Yes" MESSAGE="Enter Password">
        </TD></TR>
    </CFOUTPUT> 

        <TR><TD>User Type</TD><TD>
        <SELECT NAME="User_Level">
        <CFLOOP LIST="Administrator,Salesperson,Customer" INDEX="User_Level">
            <CFOUTPUT>          
            <option VALUE="#User_Level#" <cfif #User_Level# is #GetCustomer.User_Level#>Selected</CFIF> >#User_Level#
            </CFOUTPUT>         
        </CFLOOP>
        </SELECT>
        </TD><TD>Account Status</TD>
        <TD>Enabled
        <INPUT TYPE="Radio" NAME="Customer_Status" VALUE="1" <cfif #GetCustomer.Customer_Status# is 1>CHECKED</cfif> >
        Disabled
        <INPUT TYPE="Radio" NAME="Customer_Status" VALUE="0" <cfif #GetCustomer.Customer_Status# is 0>CHECKED</cfif> >
        </TD></TR>

        <TR><TD NOWRAP><BR>
        Here Now <BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="here_now" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.here_now#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>
        Coming Soon<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="coming_soon" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.coming_soon#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        All Items<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="all_items" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.all_items#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        Hot List<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="hot_list" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.hot_list#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD></TR>
        <TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD></TR>       
    <CFOUTPUT>
        <TR><TD COLSPAN="4">
        <INPUT TYPE="Hidden" VALUE="#GetCustomer.Customer_Id#" NAME="Customer_Id">
    <CFIF url.mode is NOT "invalid">
        <INPUT TYPE="Submit" VALUE=" update ">  
    </CFIF>
        </TD><TR>
    </CFOUTPUT> 
    </CFFORM>
    </TABLE>

    </CFIF>
</TD></TR>

<TR><TD ALIGN="center" VALIGN="top">
    <TABLE ALIGN="center" CELLPADDING="2" CELLSPACING="0">
    <CFFORM ACTION="AdminCustomer.cfm?mode=Add" METHOD="post" NAME="addCustomer">
    <CFIF url.mode is "invalid">
    <TR><TH NOWRAP ALIGN="center">  
    <FONT CLASS="errortext">The User Name submitted already exists!
    </TH></TR>  
    <CFSET User_Name = "">
    <CFELSE>
    <CFSCRIPT>
            User_Name = "";
            Password = "";
            First_Name = "";
            Last_Name = "";
            Company_Name = "";
            First_Name = "";
            Fax_Number = "";
            Hot_list = "";
            Coming_Soon = "";
            Here_Now = "";
            All_Items = "";
    </CFSCRIPT>
    </CFIF>

    <TR><TH>Add Customer</TH></TR>
    <TR><TD>
        <TABLE ALIGN="center" CELLPADDING="2">
        <CFOUTPUT>          
        <TR><TD>First Name</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#First_Name#" MAXLENGTH="50" NAME="First_Name" REQUIRED="Yes" MESSAGE="Enter First Name">
        </TD>
        <TD>Last Name</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Last_Name#" MAXLENGTH="50" NAME="Last_Name" REQUIRED="Yes" MESSAGE="Enter Last Name">
        </TD></TR>

        <TR><TD>Company</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Company_Name#" MAXLENGTH="50" NAME="Company_Name" REQUIRED="Yes" MESSAGE="Enter Company Name">
        </TD>
        <TD>Fax ( 14153446789 )</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Fax_Number#" MAXLENGTH="11" NAME="Fax_Number" REQUIRED="Yes" VALIDATE="integer" RANGE="0000000000,19999999999" MESSAGE="Enter a proper fax number ( 14153768888 )">
        </TD></TR>

        <TR><TD>User Name</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#User_Name#" MAXLENGTH="50" NAME="User_Name" REQUIRED="Yes" MESSAGE="Enter User Name">
        </TD>
        <TD>Password</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Password#" MAXLENGTH="50" NAME="Password" REQUIRED="Yes" MESSAGE="Enter Password">
        </TD></TR>
        </CFOUTPUT> 

        <TR><TD NOWRAP><BR>
        Here Now <BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="here_now" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#here_now#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>
        Coming Soon<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="coming_soon" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#coming_soon#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        All Items<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="all_items" VALUE="#Fax_Frequency_Id#"  <CFIF #listfind(#all_items#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        Hot List<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="hot_list" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#hot_list#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> >&nbsp;#Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD></TR>
        <TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD></TR>       
        <TR><TD>User Type</TD>
        <TD>
            <SELECT NAME="User_Level">
            <CFLOOP LIST="Administrator,Salesperson,Customer" INDEX="User_Level">
                <CFOUTPUT>          
                <option VALUE="#User_Level#" <cfif #User_Level# is "Customer">Selected</CFIF> >#User_Level#
                </CFOUTPUT>         
            </CFLOOP>
            </SELECT>
        </TD><TD>
        <INPUT TYPE="Submit" VALUE=" Add Customer">  
        </TD><TR>
        </CFFORM>
        </TABLE>
        </TD></TR>
    </TABLE>
    </TD></TR>

I get this error (see code below error):

Error Executing Database Query.

Syntax error in UPDATE statement.

The error occurred in 

C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 54
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 53
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 1
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 54
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 53
Called from C:\Sites\laroccaseafood\www.laroccaseafood.com\wwwroot\Admin\AdminCustomer.cfm: line 1
52 :    </CFCASE>
53 :    <CFCASE VALUE="update">
54 :        <CFUPDATE TABLENAME="Customer" DATASOURCE="#client.datasource#">
55 :        <CFQUERY NAME="GetCustomer" DATASOURCE="#client.datasource#">
56 :            Select * From Customer

CODE EXAMPLE:

Line 1 to 4 are as follows:

<CFQUERY Name="GetFaxFrequency" datasource="#client.datasource#">
    Select * From Fax_Frequency
    Order By Fax_Frequency_Id
</CFQUERY>

Error code derived from this code below:

<TR><TD VALIGN="top">
<CFSET mode_list = "add,edit,update,invalid">
    <CFIF ListContainsNoCase(mode_list, url.mode)>
    <CFIF url.mode is "invalid">
        <TABLE ALIGN="center" CELLPADDING="2" CELLSPACING="0" BGCOLOR="Red">
        <TR><TH COLSPAN="4">Current Customer Record</TH></TR>
    <CFELSE>
        <TABLE ALIGN="center" CELLPADDING="2" CELLSPACING="0">
        <TR><TH COLSPAN="4">Edit Customer</TH></TR>
    </CFIF>
    <CFFORM ACTION="AdminCustomer.cfm?mode=update" METHOD="post" NAME="addCustomer">


    <CFOUTPUT>          
        <TR><TD>First Name</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.First_Name#" MAXLENGTH="50" NAME="First_Name" REQUIRED="Yes" MESSAGE="Enter First Name">
        </TD><TD>Last Name</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Last_Name#" MAXLENGTH="50" NAME="Last_Name" REQUIRED="Yes" MESSAGE="Enter Last Name">
        </TD></TR>

        <TR><TD>Company</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Company_Name#" MAXLENGTH="50" NAME="Company_Name" REQUIRED="Yes" MESSAGE="Enter Company Name">
        </TD><TD>Fax ( 4153446789 )</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Fax_Number#" MAXLENGTH="11" NAME="Fax_Number" REQUIRED="Yes" VALIDATE="integer" RANGE="0000000000,19999999999" MESSAGE="Enter a proper fax number ( 14153768888 )">
        </TD></TR>

        <TR><TD>User Name</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.User_Name#" MAXLENGTH="50" NAME="User_Name" REQUIRED="Yes" MESSAGE="Enter User Name">
        </TD><TD>Password</TD><TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#GetCustomer.Password#" MAXLENGTH="50" NAME="Password" REQUIRED="Yes" MESSAGE="Enter Password">
        </TD></TR>
    </CFOUTPUT> 

        <TR><TD>User Type</TD><TD>
        <SELECT NAME="User_Level">
        <CFLOOP LIST="Administrator,Salesperson,Customer" INDEX="User_Level">
            <CFOUTPUT>          
            <option VALUE="#User_Level#" <cfif #User_Level# is #GetCustomer.User_Level#>Selected</CFIF> >#User_Level#
            </CFOUTPUT>         
        </CFLOOP>
        </SELECT>
        </TD><TD>Account Status</TD>
        <TD>Enabled
        <INPUT TYPE="Radio" NAME="Customer_Status" VALUE="1" <cfif #GetCustomer.Customer_Status# is 1>CHECKED</cfif> >
        Disabled
        <INPUT TYPE="Radio" NAME="Customer_Status" VALUE="0" <cfif #GetCustomer.Customer_Status# is 0>CHECKED</cfif> >
        </TD></TR>

        <TR><TD NOWRAP><BR>
        Here Now <BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="here_now" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.here_now#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>
        Coming Soon<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="coming_soon" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.coming_soon#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        All Items<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="all_items" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.all_items#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        Hot List<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="hot_list" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#GetCustomer.hot_list#,#Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD></TR>
        <TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD></TR>       
    <CFOUTPUT>
        <TR><TD COLSPAN="4">
        <INPUT TYPE="Hidden" VALUE="#GetCustomer.Customer_Id#" NAME="Customer_Id">
    <CFIF url.mode is NOT "invalid">
        <INPUT TYPE="Submit" VALUE=" update ">  
    </CFIF>
        </TD><TR>
    </CFOUTPUT> 
    </CFFORM>
    </TABLE>

    </CFIF>
</TD></TR>

<TR><TD ALIGN="center" VALIGN="top">
    <TABLE ALIGN="center" CELLPADDING="2" CELLSPACING="0">
    <CFFORM ACTION="AdminCustomer.cfm?mode=Add" METHOD="post" NAME="addCustomer">
    <CFIF url.mode is "invalid">
    <TR><TH NOWRAP ALIGN="center">  
    <FONT CLASS="errortext">The User Name submitted already exists!
    </TH></TR>  
    <CFSET User_Name = "">
    <CFELSE>
    <CFSCRIPT>
            User_Name = "";
            Password = "";
            First_Name = "";
            Last_Name = "";
            Company_Name = "";
            First_Name = "";
            Fax_Number = "";
            Hot_list = "";
            Coming_Soon = "";
            Here_Now = "";
            All_Items = "";
    </CFSCRIPT>
    </CFIF>

    <TR><TH>Add Customer</TH></TR>
    <TR><TD>
        <TABLE ALIGN="center" CELLPADDING="2">
        <CFOUTPUT>          
        <TR><TD>First Name</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#First_Name#" MAXLENGTH="50" NAME="First_Name" REQUIRED="Yes" MESSAGE="Enter First Name">
        </TD>
        <TD>Last Name</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Last_Name#" MAXLENGTH="50" NAME="Last_Name" REQUIRED="Yes" MESSAGE="Enter Last Name">
        </TD></TR>

        <TR><TD>Company</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Company_Name#" MAXLENGTH="50" NAME="Company_Name" REQUIRED="Yes" MESSAGE="Enter Company Name">
        </TD>
        <TD>Fax ( 14153446789 )</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Fax_Number#" MAXLENGTH="11" NAME="Fax_Number" REQUIRED="Yes" VALIDATE="integer" RANGE="0000000000,19999999999" MESSAGE="Enter a proper fax number ( 14153768888 )">
        </TD></TR>

        <TR><TD>User Name</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#User_Name#" MAXLENGTH="50" NAME="User_Name" REQUIRED="Yes" MESSAGE="Enter User Name">
        </TD>
        <TD>Password</TD>
        <TD>
        <CFINPUT TYPE="Text" SIZE="20" VALUE="#Password#" MAXLENGTH="50" NAME="Password" REQUIRED="Yes" MESSAGE="Enter Password">
        </TD></TR>
        </CFOUTPUT> 

        <TR><TD NOWRAP><BR>
        Here Now <BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="here_now" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#here_now#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>
        Coming Soon<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="coming_soon" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#coming_soon#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        All Items<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="all_items" VALUE="#Fax_Frequency_Id#"  <CFIF #listfind(#all_items#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD><TD NOWRAP><BR>    
        Hot List<BR><FONT CLASS="normaltext">
            <CFOUTPUT QUERY="GetFaxFrequency">
            <INPUT TYPE="Checkbox" NAME="hot_list" VALUE="#Fax_Frequency_Id#" <CFIF #listfind(#hot_list#, #Fax_Frequency_Id#)# is not 0>Checked</CFIF> > #Fax_Frequency_Desc#<BR>
            </CFOUTPUT>
        </TD></TR>
        <TR><TD><BR></TD><TD><BR></TD><TD><BR></TD><TD><BR></TD></TR>       
        <TR><TD>User Type</TD>
        <TD>
            <SELECT NAME="User_Level">
            <CFLOOP LIST="Administrator,Salesperson,Customer" INDEX="User_Level">
                <CFOUTPUT>          
                <option VALUE="#User_Level#" <cfif #User_Level# is "Customer">Selected</CFIF> >#User_Level#
                </CFOUTPUT>         
            </CFLOOP>
            </SELECT>
        </TD><TD>
        <INPUT TYPE="Submit" VALUE=" Add Customer">  
        </TD><TR>
        </CFFORM>
        </TABLE>
        </TD></TR>
    </TABLE>
    </TD></TR>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

他夏了夏天 2024-12-16 20:41:21

忽略其他一些问题..我的猜测是您正在使用 MS Access Unicode 数据源,并且 Password 可能是保留字。如果是这样,请重命名该列(首选)或切换到常规 并用方括号将其转义,即 [Password]

UPDATE Customer
SET    [Password] = <cfqueryparam value="#form.password#" ....>
...

更新:虽然我仍在猜测您的数据库/DSN,但我可以确认密码是该驱动程序的保留字。这个包含两个字段的简单测试失败了,并出现完全相同的错误。删除密码字段,就成功了。这并不是说这是唯一的问题......

<cfupdate tableName="Customer" formfields="first_name,password" datasource="#dsn#">

Ignoring a few other issues .. my guess is you are using an MS Access Unicode datasource and that Password may be a reserved word. If so, either rename the column (preferable) or switch to a regular <cfquery> and escape it with square brackets ie [Password].

UPDATE Customer
SET    [Password] = <cfqueryparam value="#form.password#" ....>
...

Update: While I am still guessing about your database/dsn, I can confirm that Password is a reserved word with that driver. This simple test with two fields fails with the exact same error. Remove the Password field and it succeeds. That is not to say it is the only issue ...

<cfupdate tableName="Customer" formfields="first_name,password" datasource="#dsn#">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文