To fix this, add the highlighted using statement to your code:
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
The System.Reflection namespace houses all of the types that are used to obtain information regarding
assemblies, modules, members, and other aspects of an assembly. LINQ to SQL uses this because the
MethodInfo class is part of the System.Reflection namespace, and the MethodInfo class is used to
identify the exact behavior of an operation.
Now press the F5 key to compile and run the project. You shouldn??™t get any errors this time, so when the
form opens, click button1. This will execute the stored procedure you created earlier.
Just as an FYI, this example uses the SalesPersonID of 275 to pass in to the stored procedure. You are free
to select another SalesPersonID. When button1 is pressed, the DataContext passes the SalesPersonID
233
Part III: LINQ to SQL
to SQL Server and asks for the stored procedure to be executed. The DataContext then handles the
returned resultsets and passing of the results to LINQ for iteration through the results.
Pages:
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380