Time column in MySQL??!!?!

Netnoobie

Well-known member
Joined
Feb 6, 2003
Messages
94
Location
Philadelphia
So I have a column in a MySQL table that is "Time". OK...when I write a simple query like:
Code:
UPDATE Daily
Set TimeOut = 3:14:40 PM
Where DailyID = 8
The item updates properly, the birds sing, and the sky is sunny. However, nothing I try in ASP.NET works, and I get this error:

System.InvalidCastException: Specified cast is not valid. at System.Data.Common.TimeSpanStorage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldnt store <3:49:41 PM> in TimeOut Column. Expected type is TimeSpan.

So whats the deal with this? Im adding a row to a DataGrid and I get this error. Is this occuring in the database even? Ive tried about every single thing I could think of to format the time and it always fails. We just switched this application over from SQL Server and Im having to hook everything back up again with minimal success it seems.

Any help would be greatly appreciated.

Cheers!
 
Thanks for replying! The field is defined as Time that allows nulls. Thats it. Theres just something odd with MySQL it seems when I try to write out Time. But since the query works I dont know if the issue is in the table or the Microsoft ODBC dll and .NET.

Thanks again.
 
Back
Top