当web.config 里
<system.web>
<globalization culture="en-GB" />
设置为英国
英国默认的日期格式为 dd/MM/yyyy
而一般美国,加拿大服务器的的默认区域为 “en-US” 可以用 SELECT @@LANGUAGE 查看当前区域
美国的日期格式默认为MM/dd/yyyy,服务器数据库就会把程序中的 dd/MM/yyyy 解读为 MM/dd/yyyy格式
就会出现类似
从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: 从 char 数据类型到 datetime 数据类型的转换导致 datetime 值越界。
这种错误
解决办法:
在数据库中新建用户,选择默认语言为:British English,使用这个用户就行了
玩技术,要学会忍受寂寞--