Unable to convert MySQL date/time value to System.DateTime

后端 未结 9 876
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-08 22:04

I am using ibatis and C#. i get a result from a select query that has CreatedDate as one of the field. The Datatype of CreatedDate in Mysql is Date. I assign the result set

9条回答
  •  半阙折子戏
    2020-12-08 22:41

    This worked for me:

    SELECT 
        IF(tb.Date1 = '0000-00-00 00:00:00', NULL, tb.Date1) AS ValidDate
    FROM MyTable AS tb
    

提交回复
热议问题