Topic: How to execute a non-query SQL stored procedure in asp.net core razor pages
I'm currently going through tutorials to help me learn Razor pages after many years of webforms.
I currently have the following code that returns data from an sql stored procedure when a button is pushed:
public IEnumerable SaveDeviationRequestResult(string SUB_ID)
var parameters = new List();
parameters.Add(new SqlParameter("@SUB_ID", SUB_ID));
//return context.Employees.Find(id); //If you want to use pure sql
return context.apiDeviationRequests.FromSqlRaw("CV2.Get_WorkstationDeviationRequests @SUB_ID", parameters: parameters.ToArray())
I did this just to ensure the button was being triggered but I want to run a stored procedure CV2.Save_DeviationAuth that has 2 parameters. @DeviationID int and @DeviationResult varchar(10)
This is a non-query stored procedure that doesn't return a result set. How do I do this please as the above code is only for stored procedures that return data?