String to DateTime in C# to save in SQL server

Posted by Ashwani K on Stack Overflow See other posts from Stack Overflow or by Ashwani K
Published on 2010-04-22T17:57:03Z Indexed on 2010/04/22 18:03 UTC
Read the original article Hit count: 285

Filed under:
|
|

Hello All:

I am an issue while converting "March 16-17" to DateTime and saving it to SQL server. "March 16-17" as it looks, read as March 16 to March 17, which in my case is invalid, but C# DateTime.TryParse() is treating "March 16 -17" as March 16, 2017 which is wrong, and saving the data in SQL server. SQL server treats "March 16-17" as invalid. So, can some body tell me how to use SQL server datetime validation in C#.

Thanks Ashwani

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server