cannot implicitly convert type System.DateTime? to System.DateTime.
2017-10-16 10:43
736 查看
userBirthday = entity.UBI_Birthday ;
问题:
cannot implicitly convert type System.DateTime? to System.DateTime.
原因:
在sqlserver中设置了datetime可以为null,但datetime不可以为null,要设置defaultValue
解决方法:
userBirthday = entity.UBI_Birthday ?? DateTime.MinValue;
问题:
cannot implicitly convert type System.DateTime? to System.DateTime.
原因:
在sqlserver中设置了datetime可以为null,但datetime不可以为null,要设置defaultValue
解决方法:
userBirthday = entity.UBI_Birthday ?? DateTime.MinValue;
相关文章推荐
- Cannot implicitly convert type 'System.Web.HttpPostedFile' to 'System.Web.HttpPostedFileBase'
- Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'(无法将类型'ASP.login_aspx' 转换为'System.Web.UI.WebControls.Lo
- 发布网站时CS0030: Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'
- implicitly convert type 'int' to 'short'的原因与解决方法
- Cannot convert type ‘ASP.login_aspx’ to ‘System.Web.UI.WebControls.Login’的解决方法
- Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'
- Cannot convert type ‘ASP.login_aspx’ to ‘System.Web.UI.WebControls.Login’的解决方法
- VS2005的BUG:Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'
- VS的bug :Cannot convert type 'ASP.login_aspx' to 'System.Web.UI.WebControls.Login'
- Cannot convert anonymous method to type 'System.Delegate' because it is not a delegate type
- Type mismatch: cannot convert from java.sql.Connection to com.sun.。。。问题的解决
- Unable to convert MySQL date/time value to System.DateTime 错误
- .net core 2.0 Unable to convert MySQL date/time to System.DateTime
- 由"Type mismatch: cannot convert from View to ProgressBar"联想到的类型转换错误的根源
- selenium--unittest字符串/整型问题Can't convert 'int' object to str implicitly提示解决方法
- 配置Spring Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource]
- java 中Math.sqrt()使用注意事项 Type mismatch: cannot convert from double to float
- Unable to convert MySQL date/time value to System.DateTime
- Type mismatch: cannot convert from MainFragment to Fragment 报错
- Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx'