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>

    编译通过

  • 相关阅读:
    函数中this指向问题及函数不同方式的调用
    拷贝继承
    组合继承
    借用构造函数
    继承
    UVA-11054(扫描法)
    hihocoder-1347 小h的树上的朋友(lca+线段树)
    UVA-10391(字符串检索)
    UVA-10125(中途相遇法)
    UVA-10827(前缀和降维)
  • 原文地址:https://www.cnblogs.com/lick468/p/9243554.html
Copyright © 2011-2022 走看看