entity framework - How do I execute a stored procedure that takes a parameter in Code First? -


i have stored procedure takes parameters , run codefirst implementation of ef 6.1.3. particular sp deletes rows table , doesn't return except number of rows deleted. i'm not quite sure how it. let's stored procedure sp_deletetheserows , takes single parameter, @theparam. how look? guess use executesqlcommand. be:

mycontext.database.executesqlcommand("exec dbo.sp_deletetheserows @theparam", new sqlparameter("@theparam", usersuppliedparam));

make sure have defined type of command storedprocedure like, cmd.commandtype = storedprocedure;


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -