forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule1.vb
71 lines (53 loc) · 2 KB
/
Module1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Imports System.Linq
Imports System.Data.Linq
Imports System.Data.Linq.Mapping
Module Module1
Sub Main()
' <Snippet3>
Dim db As New Northwnd("C:\...\northwnd.mdf")
Dim totalSales As Decimal? = 0
db.CustOrderTotal("alfki", totalSales)
Console.WriteLine(totalSales)
' </Snippet3>
End Sub
Sub CallMultiple()
' <Snippet5>
Dim db As New Northwnd("c:\northwnd.mdf")
' Assign the results of the procedure with an argument
' of (1) to local variable 'result'.
Dim result As IMultipleResults = db.VariableResultShapes(1)
' Iterate through the list and write results (the company name)
' to the console.
For Each compName As VariableResultShapesResult1 _
In result.GetResult(Of VariableResultShapesResult1)()
Console.WriteLine(compName.CompanyName)
Next
' Pause to view company names; press Enter to continue.
Console.ReadLine()
' Assign the results of the procedure with an argument
' of (2) to local variable 'result.'
Dim result2 As IMultipleResults = db.VariableResultShapes(2)
' Iterate through the list and write results (the order IDs)
' to the console.
For Each ord As VariableResultShapesResult2 _
In result2.GetResult(Of VariableResultShapesResult2)()
Console.WriteLine(ord.OrderID)
Next
' </Snippet5>
End Sub
Sub method7()
' <Snippet7>
Dim db As New Northwnd("c:\northwnd.mdf")
Dim sprocResults As IMultipleResults = _
db.MultipleResultTypesSequentially
' First read products.
For Each prod As Product In sprocResults.GetResult(Of Product)()
Console.WriteLine(prod.ProductID)
Next
' Next read customers.
For Each cust As Customer In sprocResults.GetResult(Of Customer)()
Console.WriteLine(cust.CustomerID)
Next
' </Snippet7>
End Sub
End Module