将 numeric 转换为数据类型 numeric 时出现算术溢出错误

保存数据时控制台报错:

 1 Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: 将 numeric 转换为数据类型 numeric 时出现算术溢出错误。
 2     at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
 3     at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1515)
 4     at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:404)
 5     at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
 6     at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
 7     at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
 8     at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
 9     at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
10     at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(SQLServerPreparedStatement.java:314)
11     at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2717)
12     at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1052)
13     at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)
14     at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2715)
15     at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:106)
16     at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:237)
17     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
18     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
19     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
20     at java.lang.reflect.Method.invoke(Method.java:498)
21     at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
22     ... 91 more
View Code

数据库长度比例(SqlServer字段长度和比例指什么意思?)

前台传来的参数为1000,格式不对

添加前台文本框进行校验:

1 onkeyup= "if( !/^(((\d|[1-9]\d|[1-9]\d[1-8])(\.\d+)?)|(999(\.\d{1,2})?))$/.test(this.value)){
2                            alertTip('不得超过1000,保留小数点后2位');
3                            this.value='';
4                        }"
View Code

后台接收参数后也要校验(略)

猜你喜欢

转载自www.cnblogs.com/yadongliang/p/9544015.html
今日推荐