C# DateTime Class and Datetime in database

Posted by Spyros on Stack Overflow See other posts from Stack Overflow or by Spyros
Published on 2010-06-18T06:51:34Z Indexed on 2010/06/18 6:53 UTC
Read the original article Hit count: 298

Filed under:
|
|
|
|

Hello . I have the following problem.

I have an object with some DateTime properties , and a Table in database that I store all that objects , in Sql server I want to store the DateTime properties in some columns of DateTime Datatype, but the format of datetime in sql server is different from the DateTime class in c# and I got an sql exception saying "DateTime cannot be parsed". I know how to solve this by making the format yyyy-MM-dd but is this the proper and best solution to do this?

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql