{"id":70,"date":"2012-10-23T13:41:58","date_gmt":"2012-10-23T12:41:58","guid":{"rendered":"http:\/\/www.riedmann.it\/blog\/?p=70"},"modified":"2012-10-23T13:43:25","modified_gmt":"2012-10-23T12:43:25","slug":"mysql-and-null-date-values","status":"publish","type":"post","link":"https:\/\/blog.riedmann.it\/?p=70","title":{"rendered":"MySQL and null date values"},"content":{"rendered":"<p>Today I have lost about two hours to work around a very strange MySQL Connector.NET behaviour.<\/p>\n<p>This code <\/p>\n<p>oMySQLDataReader:IsDbNull( nFieldPos )<\/p>\n<p>gives an exception if the value is a date and has a null value. The exact error was<\/p>\n<p>&#8220;unable to convert MySQL date\/time value to System.datetime&#8221;<\/p>\n<p>I have tried several things, but even<\/p>\n<p>oMySqlDataReader:GetMySQLDateTime( nFieldPos) <\/p>\n<p>fails.<br \/>\nSome messages suggested to add <\/p>\n<p>&#8220;Allow Zero Datetime=true;&#8221; <\/p>\n<p>to the connection string, but with this one I was unable to retrieve ANY date value.<\/p>\n<p>Only adding<\/p>\n<p>&#8220;Convert Zero Datetime=true;&#8221; <\/p>\n<p>to the connection string solved the problem. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I have lost about two hours to work around a very strange MySQL Connector.NET behaviour. This code oMySQLDataReader:IsDbNull( nFieldPos ) gives an exception if the value is a date and has a null value. The exact error was &#8220;unable to convert MySQL date\/time value to System.datetime&#8221; I have tried several things, but even oMySqlDataReader:GetMySQLDateTime( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-vulcan-net-programming"],"_links":{"self":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=70"}],"version-history":[{"count":2,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":72,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions\/72"}],"wp:attachment":[{"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.riedmann.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}