I use this code to define my stored procedure
CREATE PROCEDURE [dbo].[SP]
(@Country NVARCHAR(20))
AS
BEGIN
SET NOCOUNT ON;
SELECT c.*,O.* from Customers
as c inner join orders O on c.CustomerID=o.CustomerID
where c.Country=@Country
END
and this is my C# code:
IList<Entities.Customer> Customers;
using (var context = new NorthwindContext())
{
SqlParameter categoryParam = new SqlParameter("@Country", "London");
Customers = context.Database.SqlQuery<Entities.Customer>("SP @Country", categoryParam).ToList();
}
Problem is here :
I want to message the data from Orders
table and my stored procedure generate this to me. How can I get the Orders
data in my C# code? Remember I want to execute this stored procedure only once.