I have written this stored procedure that accepts the clientId
as parameter. As you can see in the SQL Server trace, I have passed the client id while calling from .NET, but still its showing the error that clientId
parameter is not supplied. What am I doing wrong?
Stored procedure:
SQL Server trace when calling from .NET:
I'm still getting the error:
Procedure or function 'USP_LoadPerformaceTemplate' expects parameter '@clientId', which was not supplied.
In your C# code (which you haven't shown us), you have not set CommandType
command.CommandType = CommandType.StoredProcedure;
// or
using (var command = new ... { CommandType = CommandType.StoredProcedure})
So what is happening is that the SQL is being interpreted as a direct query batch:
[dbo].[USP_LoadPerformaceTemplate]
The word EXEC
is not needed. So it is trying to execute it without the parameter.
But when CommandType.StoredProcedure
is specified, it is sent as an RPC command to call the stored procedure.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.