Skip to content Skip to sidebar Skip to footer

How To Return Values To Web Api Controller From A Stored Procedure In Dbcontext

I am trying validate values to be inserted into SQL from Web API 2 and Repository Pattern. The database has a stored procedure for checking the values passed (foreign key dependen

Solution 1:

You need to use Database.SqlQuery, which lets you execute an stored procedure, or any other query, and get the results of the execution.

ExecuteSqlCommand is only useful for running queries from which don't need to return the data (for example updates or DDL sentences).

Post a Comment for "How To Return Values To Web Api Controller From A Stored Procedure In Dbcontext"