I use the MySQL database to work in ASP.NET MVC 3, I have already configured all the requirements, and the connection is working fine. This code below works correctly and gives the correct result :
try { ViewBag.Model = (from n in _db.mainDatas where n.time_stamp == new DateTime(2010, 11, 3, 0, 0, 15) select n).Take(10).ToList(); }catch (Exception e) { ViewBag.Error = e; }
But when I change this code to:
DateTime test = new DateTime(2010,11,3,0,0,15); try { ViewBag.Model = (from n in _db.mainDatas where n.time_stamp == test select n).Take(10).ToList(); }catch (Exception e) { ViewBag.Error = e; }
this error message is generated:
MySql.Data.MySqlClient.MySqlException: a fatal error occurred while executing a command. ---> MySql.Data.MySqlClient.MySqlException: Unable to serialize date / time value
I am using MySQL Connector / Net 6.3.6. Any solution to this problem?
source share