[英]Error when converting numeric to data type numeric
I have little error when converting numeric to data type numeric. 将数字转换为数据类型数字时,我几乎没有错误。 i need to take hours(decimal) between 2 date (dateTime). 我需要花费2个日期(dateTime)之间的小时(十进制)。
but I see error 但我看到错误
System.Data.SqlClient.SqlException: Arithmetic overflow error converting numeric to data type numeric. System.Data.SqlClient.SqlException:将数值转换为数据类型numeric的算术溢出错误。
var hours = (dateTime1 - dateTime2).TotalHours;
res = Math.Round(Convert.ToDecimal(hours),2);
how can i clean take hours? 我怎么能清洁需要几个小时?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.