如何解决SqlDateTime溢出的问题? [英] how to solve the problem of SqlDateTime overflow ?

查看:656
本文介绍了如何解决SqlDateTime溢出的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正面临
的错误
SqlDateTime溢出.必须在1/1/1753 12:00:00 AM和12/31/9999 11:59:59 PM之间."


我使用日期时间为数据类型的字段DOB,并且在提交数据时返回了我上面提到的返回错误
我该如何解决?

I facing the error of

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM."


i take field DOB with datatype of datetime and at the time of submitting data its return error which i mention above
how can i solve it?

推荐答案

请验证您的日期输入控件.现在,它试图输入不在指定范围内的值.还允许在数据库中的该列为null.

问候
塞巴斯蒂安(Sebastian)
Please validate your date input control. Now its trying to input a value not in the specified range. Also allow null to that column in database.

Regards
Sebastian




1.确保您的机器时钟不在15世纪;-)
2.重新创建模型.(对于MVC)
3.如果您的表具有默认值,则无需在代码中进行设置.
4.考虑使用GETUTCDATE()而不是GETDATE()
5.确保没有其他没有默认值的DateTime字段.

祝一切顺利.
--Amit
Hi,

1. Make sure your machine clock is not in 15th century ;-)
2. Recreate your model.(In case of MVC)
3. It your table has default value you don''t have to set it in code.
4. Consider using GETUTCDATE() instead of GETDATE()
5. Make sure there are no other DateTime fields without default values.

All the best.
--Amit


这篇关于如何解决SqlDateTime溢出的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆