这是我的代码:
UVCUpdate update = new UVCUpdate(); update.CurrentDate = DateTime.Now; _context.UVCUpdates.Add(update); _context.SaveChanges();
现在,虽然这样说,但我得到了一个内在的例外:
Cannot insert the value NULL into column ‘CurrentDate’,table ‘bLinked.dbo.BlackbookUpdateUVC’; column does not allow nulls. INSERT fails.
9/15/2016 7:26:35 PM
我在db中将CurrentDate的数据类型设置为datetime,在类中将其设置为DateTime.既不允许空值,但DateTime.Now不应该为空吗?