Forums » General Discussion

Thread: Using Toad for the first time, can't query a table with PHP zero dates

This question is not answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: Apr 11, 2011 1:03 AM by: Peter@sids
JimC

Posts: 1
Registered: 11/15/10
Using Toad for the first time, can't query a table with PHP zero dates
Posted: Nov 15, 2010 12:59 PM
 
  Click to reply to this thread Reply

PHP has a convention where instead of null, people put '0000-00-00' into date fields.  Running a simple select on a table with these values in Toad fails with the error:
 
MySql.Data.Types.MySqlConversionException
Unable to convert MySQL date/time value to System.DateTime
Stack Trace:
   at MySql.Data.Types.MySqlDateTime.GetDateTime()
   at MySql.Data.MySqlClient.MySqlDataReader.GetValue(Int32 i)
   at Quest.Toad.Db.Connection.ReadRow(IDataReader reader, FastTable datatable, FastReadOptions options, PrePostProcessHandler prePostProcessHandler)
   at Quest.Toad.Db.ToadDataAdapter.InternalReadBackground()


I can leave out the column with that value and run a query just fine.  Are there any options to configure how Toad connects to mysql or pulls back this data?  Any other hints for this?

Using Toad 5.0.0.345 on Windows Vista x64.




Shodantos

Posts: 2
Registered: 2/28/11
Re: Using Toad for the first time, can't query a table with PHP zero dates
Posted: Feb 28, 2011 2:45 AM   in response to: JimC
 
  Click to reply to this thread Reply

I have the same problem, it already appears when i open the dataview of one of my tables.


MySql.Data.Types.MySqlConversionException
Unable to convert MySQL date/time value to System.DateTime
Stack Trace:
   at MySql.Data.Types.MySqlDateTime.GetDateTime()
   at MySql.Data.MySqlClient.MySqlDataReader.GetValue(Int32 i)
   at Quest.Toad.Db.Connection.ReadRow(IDataReader reader, FastTable datatable, FastReadOptions options, PrePostProcessHandler prePostProcessHandler)
   at Quest.Toad.Db.ToadDataAdapter.InternalReadBackground()





Guest
Re: Using Toad for the first time, can't query a table with PHP zero dates
Posted: Feb 28, 2011 11:13 AM   in response to: Shodantos
  Click to reply to this thread Reply

The MySQL 6.0 beta should have fixed this problem.


David Carroll

Posts: 5
Registered: 4/8/11
Re: Using Toad for the first time, can't query a table with PHP zero dates
Posted: Apr 8, 2011 4:24 PM   in response to: Guest
 
  Click to reply to this thread Reply

I wanted to confirm that I was able to resolve this issue by installing:

  - Toad for MySQL 6.0.0.759 Beta Version

from the following link:

  - http://www.toadformysql.com/beta.jspa


Peter@sids

Posts: 2
Registered: 4/11/11
Re: Using Toad for the first time, can't query a table with PHP zero dates
Posted: Apr 11, 2011 1:03 AM   in response to: JimC
 
  Click to reply to this thread Reply

this is an issue with the common runtime for microsoft, I altered the dates and the programming for the mysql db to either set to null or a date by defualt, I seleted 001-01-01 for the default, as the common rutime accepts dates from year 1 up. 

Its not a problem with Toad it is the common runtime for .NET , and a pain to fix but the DB is better for it in the end I think.


Legend
Guru: 2001 + pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums