我正在从样板中的dapper中执行以下存储过程。我点击了链接here,但出现错误
CREATE PROCEDURE [dbo].[DeleteEmployeeById]
@ID int
AS
BEGIN
DELETE FROM
[dbo].[Airport] where EmployeeID=@ID
END
过程或函数'DeleteEmployeeById'需要未提供的参数'@ID'
我使用的代码如下:
Dictionary<string, int> dictionary = new Dictionary<string, int>();
dictionary.Add("@ID", 10);
try
{
var people = _repository.Query("DeleteEmployeeById", new DynamicParameters(dictionary));
}
catch (System.Data.SqlClient.SqlException exception)
{
}
答案 0 :(得分:0)
尝试...
var people = _repository.Query("DeleteEmployeeById", new { id = 10});