简体   繁体   English

EF6存储过程没有结果

[英]EF6 stored procedure with no results

My environment is VS 2012, C#, EF6 and SQL Server 2008 R2. 我的环境是VS 2012,C#,EF6和SQL Server 2008 R2。

I want to execute a stored procedure to delete records with no return value using the pattern: 我想执行一个存储过程来使用模式删除没有返回值的记录:

dataContext.Database.SqlQuery<return type>("name", parameter)

If there are no results returned eg with NO COUNT ON what should I set as the return type? 如果没有返回结果,例如NO COUNT ON我应该设置什么作为返回类型? Seems that it should be simple but I cannot find an answer anywhere. 似乎它应该很简单但我无法在任何地方找到答案。

I tried dataContext.Database.SqlQuery("name", parameter) but that returns a compile error: The best overloaded method match for 'System.Data.Entity.Database.SqlQuery(System.Type, string, params object[])' has some invalid arguments 我尝试了dataContext.Database.SqlQuery("name", parameter)但返回编译错误: 'System.Data.Entity.Database.SqlQuery(System.Type, string, params object[])'的最佳重载方法匹配有一些无效的论点

如果您不需要查询某些数据,请使用ExecuteSqlCommand而不是SqlQuery

dataContext.Database.ExecuteSqlCommand("name", parameter)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM