Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1981
  • Last Modified:

How to pass in sql server's datetime default value which is 1/1/1900 from .NET code. It is possible to do System.Date.SqlTypes.SqlDateTime.DefaultValue?

How to pass in sql server's datetime default value which is 1/1/1900 from .NET code. It is possible to do System.Date.SqlTypes.SqlDateTime.DefaultValue?

I was able to do System.Date.SqlTypes.SqlDateTime.MinValue to get the minimum value.

Thanks in advance

Chale
0
chaleastale
Asked:
chaleastale
  • 2
1 Solution
 
elimesikaCommented:
HI

you can use

DateTime.MinValue
0
 
chaleastaleAuthor Commented:
Thanks for the reply. If you pass in empty string for a DateTime column, sql server will insert 1/1/1900 as a default value. I want to pass in this default value from .NET. For a certain reason, I can't passing in empty string.

I only need this default value. Not the minimum date
0
 
elimesikaCommented:
You can still pass a dateime object that has this value


DateTime d = new DateTime(1900,1,1);
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now