Using LINQ, how do I insert a null value into a SQL Server 2008 DateTime column?
The code below inserts "1/1/1900 12:00:00 AM", But I want to insert "NULL" instead
CreatDate = System.Data.SqlTypes.SqlDateTime.Null
Ensure that the column in the DB is set to allow NULL and your entity property, "CreateDate" is defined as "DateTime? CreateDate {get;set;}". Then, simply set "CreateDate = null".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With