我正在使用Entity Framework 5,并且从下面调用count()
string sqlStr = @"SELECT top 20 ID,CAST(DOI as DATETIME) as IDate FROM DTable"; var results = db.Database.sqlQuery<SRVM>(sqlStr); //get total count var total = results.Count();
我收到错误:
The specified cast from a materialized ‘System.DateTime’ type to the
‘System.String’ type is not valid.
有什么想法吗?