Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

New DateTime Exception

Max Power
2005-02-03
2013-04-09
  • Max Power
    Max Power
    2005-02-03

    I had been using version 3.0.1517 for a while and was experiencing some weird connections issues which I was unable to resolve. I figured I'd upgrade to the latest version to see if that resolved the problem. So I downloaded and started using version 3.0.1735.

    After a little more tinkering I figured out that the connection problems were not related to the MySWLDriverCD.dll. But I did notice a new... "problem".

    In my database I have a DateTime field which may or not be populated with a date. The latest version of MySQLDriverCS throws an exception when it encounters a DateTime field like this! From what I could find there is no way to work around it -- and as a result, I was forced to version 3.0.1517.

    Why was this exception added? I doubt I'm the only one that has DateTime fields that aren't always populated. This seems unnecessary. Shouldn't the client program make the determination if 0000-00-00 00:00:00 is a valid date or not?

     
    • see this location in the source code, this is where the problem is that you have.
      MySQLDataReader.cs
      line 160
      is how it was:
      dr[(int)i]=DateTime.ParseExact(val,"yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture.DateTimeFormat);

      what i changed it too to fix it:
      dr[(int)i]=DateTime.ParseExact(val,"yyyyMMddHHmmss", CultureInfo.InvariantCulture.DateTimeFormat);