I have a problem with a SQL Server stored procedure. Although I supply parameter, and although the parameter is not null, I got 'parameter is not supplied' error
My C# code is here:
staffInfo.DeleteCommand = "deleteStaff";
staffInfo.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure;
staffInfo.DeleteParameters.Add("tcId", stafftc);
staffInfo.Delete();
Stored procedure:
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
The delete operation is done perfectly. But I got this error anyway. What would be your suggestion?
Make sure that no BoundField controls in the data-bound control that you bind to the SqlDataSource control have names that match any parameter names in the DeleteParameters collection. Parameters that have the same name as bound fields are excluded from the SQL command, and a "parameter was not supplied" error might result.Could it be the case?@?