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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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”.