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

Last post 05-18-2008 4:23 AM by daxmax. 2 replies.

Sort Posts:

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

    05-09-2008, 11:07 AM
    • Loading...
    • tejp
    • Joined on 11-26-2006, 9:18 PM
    • Posts 41

    Hi

    I get the following error when i call my method from the class any ideas?
     

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

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime

    Source Error:

    Line 324:        string strqry = "Select * FROM tblclients";
    Line 325:
    Line 326: DataTable returnDatatbl = conClass.queryDB(strqry);
    Line 327:
    Line 328:
  • Re: Unable to convert MySQL date/time value to System.DateTime

    05-10-2008, 7:13 PM
    Answer
    • Loading...
    • avidyarthi
    • Joined on 09-20-2006, 2:00 PM
    • California
    • Posts 233

    You might want to try:

    adding this to the connection string :
    Allow Zero Datetime=true

     

    Hope this helps. 

    Thanks,

    avidyarthi.
  • Re: Unable to convert MySQL date/time value to System.DateTime

    05-18-2008, 4:23 AM
    • Loading...
    • daxmax
    • Joined on 04-16-2008, 5:42 PM
    • Posts 20

    Like the above poster mentioned it's probably a 0000-00-00 date time that  .NET doesn't like.  Do a quick debug of what value it returns and make sure it's that. Another possiblity is that the drivers on your server you are working on are older. I used to have date\time issues all the time on older drivers of mySQL. 

    "the veil has been lifted."
Page 1 of 1 (3 items)