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
![](/ArticleFiles/1430/image007.jpg)
Calling the Sproc in C#:
Figure 8
![](/ArticleFiles/1430/image008.jpg)
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
![](/ArticleFiles/1430/image009.jpg)
Which then displays the product history of our customer on a
page like so:
Figure 10
![](/ArticleFiles/1430/image010.jpg)