1
如何在实体框架中调用sp_executesql存储过程? 我需要使用Select语句动态地执行存储在SQL Server表列中的公式。我试过了ENTITY SQL,但它不起作用。如何在实体框架中调用sp_executesql存储过程?
如何在实体框架中调用sp_executesql存储过程? 我需要使用Select语句动态地执行存储在SQL Server表列中的公式。我试过了ENTITY SQL,但它不起作用。如何在实体框架中调用sp_executesql存储过程?
使用ObjectContext.ExecuteStoreCommand
(需要EF 4)。
,如果我理解正确试试这个
CREATE PROCEDURE sp_calculatesalary(@EmployeeId as int)
begin
declare @dynsql varchar(500)=' Salary,Username from employee where [email protected]'
exec sp_executesql @dynsql,'@empID int',@[email protected]
SELECT 1 as salary,2 as username
end
它解决了存储过程映射问题
我有同样的问题 – Mohsen 2011-08-13 06:52:35