@Kmcnet, Welcome to Microsoft Q&A, if you want to update the database through the stored procedure, I recommend that you could use the context.Database.ExecuteSqlRaw Method instead of FromSqlRaw method. As usual, FromSqlRaw method is used to create a LINQ query based on a raw SQL query, which is also used to query data.
Here is my code example and you could have a look.
Stored Procedure:
CREATE PROCEDURE [dbo].[TestProcedure]
@Name nvarchar(20)
AS
Update products set Description='This is a test' where Name=@Name
RETURN 0
c# code:
MyContext context = new MyContext();
context.Database.ExecuteSqlRaw("TestProcedure @p0", parameters: new[] { "test1"});
Tested result:
Hope my solution could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.