【发布时间】:2013-10-30 10:37:58
【问题描述】:
我无法将值保存到两个可为空的列中。
这是我要保存的实体:
nquote_orderheaders header = new nquote_orderheaders()
{
CreatedDate = DateTime.Now,
SendDate = DateTime.Now,
SentByUser = accountInfo.Username,
CreatedByUser = accountInfo.Username,
QuoteOrderNumber = tempQuoteNumber,
IMCustomerNumber = resellerInfo.CustomerNo,
CustomerEmail = accountInfo.Username,
CustomerName = resellerInfo.CustomerName,
UserComment = "",
StatusId = 1,
CustomerId = data.CustomerId,
ExpirationDate = DateTime.Now.AddDays(14)
};
SendDate 和 ExpirationDate 字段是可为空的日期时间。它们最终在数据库中为空。
我将 MySql 与 MySqlConnector 6.5.4 一起使用。任何建议都非常感谢。
【问题讨论】:
-
IS CreatedDate 结束,不能为空。
-
你能粘贴到你的实体类吗?
-
我不知道
MySqlConnector,也许它对匹配类型非常挑剔。您可以尝试设置可为空的 DateTime 值:SendDate = new Nullable<DateTime>(DateTime.Now).
标签: asp.net-mvc linq entity-framework