var resultList = new DataTable();
SqlConnection connection = new SqlConnection(@"server=. ; database=PersonnelTrackingSystem;Trusted_Connection=yes");
connection.Open();
SqlDataAdapter da = new SqlDataAdapter(@"SELECT sum(takePay) FROM [PersonnelTrackingSystem].[dbo].[personnelSallaries] ", connection);
da.Fill(resultList);
return resultList;
这是我的整数取薪变量之和的sql代码。我如何用实体框架改变它们? 我试过这样但是它不起作用
PersonnelTrackingSystemEntities entity = new PersonnelTrackingSystemEntities();
return (entity.personnelSallaries.Sum(d => d.takePay)).ToString().ToList();