Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated inco...

执行更新时的出错信息

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Jun 29 15:02:45 CST 2018
There was an unexpected error (type=Internal Server Error, status=500).
### Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as4' ### The error may involve com.nenu.dao.EmployeeDao.Employee ### The error occurred while setting parameters ### SQL: update employee set emp_name = ? and emp_password = ? where id=? ### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as4' ; ]; Data truncation: Truncated incorrect DOUBLE value: 'as4'; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as4'

更新代码

<update id="updateEmployee" parameterMap="Employee">
        update
        employee
        set
        emp_name = #{emp_name}
        and emp_password = #{emp_password}        
        where 
        id=#{id}
    </update>

错误原因及更正方法

update 更新时,连接两个变量的不是and ,而是 ,

更正代码

<update id="updateEmployee" parameterMap="Employee">
        update
        employee
        set
        emp_name = #{emp_name} ,emp_password = #{emp_password}        
        where 
        id=#{id}
    </update>

编译通过

转载于:https://www.cnblogs.com/lick468/p/9243554.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值