我有一个 SQL Server 存储过程的问题。虽然我提供了参数,虽然参数不为空,但我得到了“未提供参数”错误
我的 C# 代码在这里:
staffInfo.DeleteCommand = "deleteStaff";
staffInfo.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
staffInfo.DeleteParameters.Add("tcId", stafftc);
staffInfo.Delete();
存储过程:
ALTER PROCEDURE dbo.deleteStaff
(
@tcId varchar(11)
)
AS
BEGIN
DECLARE @memId int;
SELECT @memId = staffId FROM staff WHERE TCid = @tcId;
DELETE FROM member WHERE memId = @memId;
END
删除操作完美完成。但我还是得到了这个错误。你的建议是什么?