Remember that
the DataContext is the avenue through which objects are sent to and retrieved from the database.
Here??™s a sample of the results returned:
710 Mountain Bike Socks, L 275, 5.7000
709 Mountain Bike Socks, M 275, 5.7000
773 Mountain -100 Silver, 44 275, 2039.9940
776 Mountain -100 Black, 42 275, 2024.9940
Just for your edification, you might want to place a breakpoint on the first line of code and click button1
again, this time stepping through the execution of the code.
Passing Parameters to Mapped Stored Procedures
The next example illustrates how to call a stored procedure that also accepts a parameter but returns the
results via an OUTPUT parameter.
The first step is to create the stored procedure. In SQL Server, type the following into a query window
and execute it:
CREATE PROCEDURE [dbo].[MaxOrderBySalesPersonID]
(
@salesPersonID int,
@maxSalesTotal int OUTPUT
)
AS
BEGIN
SELECT @maxSalesTotal = MAX(TotalDue)
FROM sales.salesorderheader
WHERE SalesPersonID = @salesPersonID
END
GO
This stored procedure accepts two parameters.
Pages:
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381