Link to home
Start Free TrialLog in
Avatar of pillmill
pillmill

asked on

MySqlDataReader for TIME ?

When I try to read the MySql database field of type "TIME", using the MySql datareader, I get the following error:
      
   'MySql.Data.MySqlClient.MySqlDataReader' does not contain a definition for 'GetTime'      

I can read DateTime type, but not Time. So, how can I read the field of type TIME ?
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Looks like there isn't one.  There are readers for timespan, system.datetime, or mysqldatetime.

http://dev.mysql.com/doc/refman/5.1/en/connector-net-examples-mysqldatareader.html

The next seems to imply that you should be using the mysqldatetime object instead:

http://dev.mysql.com/doc/refman/5.1/en/connector-net-using-datetime.html

Avatar of pillmill
pillmill

ASKER

OK. Is there a way then, to output the results so that the output is either:
a date(yyyy,mm,dd) OR a time (hr,min,sec) ? Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial