Calling a stored procedure with nothing to return using Entity Framework

后端 未结 1 975
一整个雨季
一整个雨季 2020-12-16 10:48

I understand this is the way we call a stored procedure using Entity Framework.

context.Database.SqlQuery(
    \"mySpName @param1, @param         


        
相关标签:
1条回答
  • 2020-12-16 11:28

    You want context.Database.ExecuteSqlCommand instead of SqlQuery

    context.Database.ExecuteSqlCommand(
        "mySpName @param1, @param2, @param3",
        new SqlParameter("param1", param1),
        new SqlParameter("param2", param2),
        new SqlParameter("param3", param3)
    );
    
    0 讨论(0)
提交回复
热议问题