Parse(textBox1.Text);
listBox1.Items.Clear();
switch (caseSwitch)
{
case 1:
IMultipleResults result1 = db.whichone(caseSwitch);
foreach (ContactsPart cp in result1.GetResult
())
{
listBox1.Items.Add(cp.ContactID + " " + cp.Title + " " +
cp.FirstName + " " + cp.LastName);
}
238
Chapter 11: LINQ to SQL Queries
break;
default:
IMultipleResults result2 = db.whichone(caseSwitch);
foreach (ProductsPart pp in result2.GetResult())
{
listBox1.Items.Add(pp.ProductID + " " + pp.Name + " " +
pp.ProductNumber);
}
break;
}
}
This code takes the value that is entered in the text box and passes that to the stored procedure. Once you
have entered the code, press F5 to build and run the project.
Another compile error, right? This time the error should say something like this:
The type of namespace name ??™IMultipleResults??™ could not be found.
Again, that??™s because you are missing a using directive. Add the highlighted using directive to
your code:
using System.Linq;
using System.Text;
using System.Windows.
Pages:
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387