I have a table in SQL server 2005 with field datatype DATETIME.
I am inserting a record to the above table via Visual C# .NET 2008 code.
Everything works but if the input is NULL then it inserts "1900-01-01 00:00:00.000" this value in the DATETIME field. I want to insert nothing in that field when the input is NULL. How can I do it...
Here is my code:
String insertStr = "INSERT INTO MyTab (LEDate) values (" +
Convert(datetime, '" + LEDate + "'))";