For the life of me I cannot get this bug figured out – I have two time fields in mysql, properly mapping as Timestamp fields in ASP.net Entity Framework. I can assign and INSERT into the db no problem, however, whenever I try to load the data back out by simply querying the database I receive the following error message: Invalid cast from ‘System.String’ to ‘System.TimeSpan’
using (hydraEntities db = new hydraEntities())
{
Employer = db.employers.Include("address").Where(em => em.EmployerId == EmployerId).First();
}
I cannot figure it out, i’ve upgraded the mysql connector to the latest release praying that would solve the bug – however that did not fix it. Any help would be GREATLY appreciated!
Try something like this.. TimeSpan is a deals with Length perhaps you meant TimeStamp..
what ever the case if you did mean TimeSpan.. can you double check and clarify..?
TimeSpan would work.. here is a something you could use.. problem is you will need to figure out the milliseconds of what’s in the timespan field to replace your milliseconds with what I have pasted in this code example