Once we've done the steps above to map a SPROC
onto our DataContext class, it is easy to use it to programmatically
retrieve data. All we need to-do is call the new method we mapped on
our DataContext class to get back a sequence of strongly typed results
from the SPROC:
Calling the SPROC in VB:
Figure 7
Calling the Sproc in C#:
Figure 8
In addition to programming looping over the result like in
the code samples above, I could also obviously bind the results to any UI
control to display them. For example, the below code databinds the result
of our SPROC to a <asp:gridview> control:
Figure 9
Which then displays the product history of our customer on a
page like so:
Figure 10