数据库更新数据,SQL一直报异常: `updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExcept
检查后发现是SQL语句写错了,set这里要使用标签,修改后正常。
·
数据库更新数据,SQL一直报异常: updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where userFileId = 'CAD1681971589000'' at line 13

检查SQL语句
<update id="updateFileInfo" parameterType="com.vanjian.entity.FileInfo">
update ourbim_user_caddoc
set
<if test="fileName != null">
fileName = #{fileName},
</if>
<if test="extand != null">
extand = #{extand},
</if>
<if test="filePath != null">
filePath=#{filePath},
</if>
<if test="addTime != null">
addTime = #{addTime},
</if>
where userFileId = #{userFileId}
</update>
检查后发现是SQL语句写错了,set这里要使用标签,修改后正常。
<update id="updateFileInfo" parameterType="com.vanjian.entity.FileInfo">
update ourbim_user_caddoc
<set>
<if test="fileName != null">
fileName = #{fileName},
</if>
<if test="extand != null">
extand = #{extand},
</if>
<if test="filePath != null">
filePath=#{filePath},
</if>
<if test="addTime != null">
addTime = #{addTime},
</if>
</set>
where userFileId = #{userFileId}
</update>
一定要细心再细心!!!
更多推荐
所有评论(0)