I am using MySQL database to work in ASP.NET MVC 3, i’ve already set up all requirements and connection is working fine. This code below is working properly and produce right 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 into :
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: Fatal error encountered during command execution. —> MySql.Data.MySqlClient.MySqlException: Unable to serialize date/time value
I am using MySQL Connector/Net 6.3.6. Any solution to this problem ?
Ok, after doing some searches and googling like crazy, finally I found the solution for my problem. Well, it’s not a solution actually, because it looks like MySQL Connector/Net 6.3.6 is not doing well with my project (maybe because of my server, database, project configurations, etc) so I use Devart dotConnector instead of MySQL Connector/Net 6.3.6 and everything works like magic. 😀