SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 377 | Next

Scott Klein

"Professional LINQ"

Product
END
GO
239
Part III: LINQ to SQL
This procedure accepts no parameter and returns two results.
Next, create a mapping to that stored procedure. In Visual Studio, add the following code below the
previous stored procedure mapping. Two result types are defined, but no parameter is defined because
the stored procedure does not accept one.
[StoredProcedure(Name = "[ContactsANDProducts]")]
[ResultType(typeof(ContactsPart))]
[ResultType(typeof(ProductsPart))]
public IMultipleResults TwoResultsets()
{
return this.ExecuteMethodCallWithMultipleResults(this,
((MethodInfo)(MethodInfo.GetCurrentMethod())));
}
The stored procedure returns the same results as the previous example (contacts and products), so this
example will use the same table mappings that were defined in the previous example. Therefore, the only
thing left to do is to add the code behind button4:
private void button4_Click(object sender, EventArgs e)
{
AdventureWorks db = new AdventureWorks("Integrated Security=sspi");
IMultipleResults results = db.TwoResultsets();
foreach (ContactsPart cp in results.


Pages:
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6