zoukankan      html  css  js  c++  java
  • Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as3'

    执行更新时的出错信息

    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>

    编译通过

  • 相关阅读:
    八月二十九学习报告
    文本操作
    EL表达式
    注解开发
    逆向
    内置对象和方法
    每日日报2020.11.10 1905
    每日日报2020.11.12 1905
    每日日报2020.11.17 1905
    每日日报2020.11.20 1905
  • 原文地址:https://www.cnblogs.com/lick468/p/9243554.html
Copyright © 2011-2022 走看看