我正在使用asp核心剃须刀页面, 而且我正在尝试通过控制器将数据作为json返回
这对我来说很好:
return Json(new { data = _db.Clients.FromSqlRaw("select * from Clients where nom_createur != 'X'").ToList() });
但是这个
return Json(new { data = _db.Clients.FromSqlRaw("select nom_createur,COUNT(Id_Client) as 'counte' from clients where Nom_Createur != 'X' group by nom_createur").ToList() });
出现此错误:
The required column 'Id_Client' was not present in the results of a 'FromSql' operation
ps:我真的需要使用 FromSqlRaw