I have a database where the columns are int datatypes. The column values correspond to seconds from 1980-01-01 (MS-DOS timestamp).
Is it possible to convert these int values using Entity Framework? If this is not so? Conversion must be effective.
I tried the following SQL in my controller, but I get a JSON error from the client (Fiddler output: JSON = -1):
public JsonResult GetData() { var model = entities.Database.ExecuteSqlCommand( @"SELECT TOP 10 dateadd(S, [timestamp], '1980-01-01') [datetime_conv], [value] FROM [Data_2696415_20] AS tabel"); return Json(model, JsonRequestBehavior.AllowGet); }
I am using Entity Framework version 6.1.
source share