Contact
WHERE ContactID = 1172
212
Chapter 10: LINQ to SQL Overview
Figure 10-3
You should get the following results:
ContactID FirstName LastName
--------- --------- --------
1174 Scott Gode
Now, execute the following query:
SELECT EmployeeID, NationalIDNumber, ManagerID, Title
FROM HumanResources.Employee
WHERE ContactID = 174
213
Part III: LINQ to SQL
Figure 10-4
Here are the results:
EmployeeID NationalIDNumber ManagerID Title
---------- ---------------- --------- -----
98 199546871 197 Production Technician - WC45
You can see that the ContactID values in both the Person.Contact table and the HumanResources.
Employee table match. The foreign key constraint ensures that any value inserted into the
ContactID column in the HumanResources.Employee table matches a value in the ContactID column
in the Person.Contact table. To test this, try to insert a row into the HumanResources.Employee table
using the value of 20000 for the ContactID. You should get an error from SQL Server because there is no
row in the Person.Contact table with ContactID = 20000.
Pages:
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352