Skip to content
Advertisement

How to get output parameter results and query result from stored procedure?

I have this stored procedure

which I call from C# using Entity Framework Core using a DbContext

When I call the SP from code, the output parameters are empty. How to get the output parameter values in code?


When I call the SP directly from SQL the output parameters are populated correctly.

Advertisement

Answer

You’re missing the OUTPUT keyword when building the parameters in the SQL text:

Should be:

You can fix that by modifying the line where you add the parameters to the SQL text:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement