Forms;
using System.Reflection;
using System.Data.Ling.Provider;
You have to include this namespace because it provides the capability to handle multiple results. Now,
press F5 again, and when the application runs, enter either 1 or 2 in the text box. Based on the stored
procedure and the number you entered, you should get either a list of contacts or a list of products. If
you entered a value of 1, you get a list of contacts with four columns. If you entered a value of 2, you get
a list of products with three columns.
This is accomplished by passing either the ContactPart mapping or the ProductPart mapping when
calling the stored procedure.
OK, one last stored procedure example. The preceding was an ??????or??™??™ example, in that it returns the
contact result or the product result. This example returns both. In SQL Server, create the following
stored procedure:
CREATE PROCEDURE [dbo].[ContactsANDProducts]
AS
BEGIN
SELECT ContactID, Title, FirstName, LastName FROM Person.Contact
SELECT ProductID, Name, ProductNumber FROM Production.
Pages:
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388