forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule1.vb
33 lines (24 loc) · 829 Bytes
/
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
Module Module1
Sub Main()
' <Snippet1>
Dim db As New Northwnd("…\Northwnd.mdf")
Dim cust As Customer = _
(From c In db.Customers _
Where c.CustomerID = "ALFKI" _
Select c) _
.First()
' Change the name of the contact.
cust.ContactName = "New Contact"
' Create and add a new Order to Orders collection.
Dim ord As New Order With {.OrderDate = DateTime.Now}
cust.Orders.Add(ord)
' Delete an existing Order.
Dim ord0 As Order = cust.Orders(0)
' Removing it from the table also removes it from
' the Customer’s list.
db.Orders.DeleteOnSubmit(ord0)
' Ask the DataContext to save all the changes.
db.SubmitChanges()
' </Snippet1>
End Sub
End Module