About the Authors |
|
xix | |
About the Technical Reviewer |
|
xxi | |
Acknowledgments |
|
xxiii | |
Introduction |
|
xxv | |
|
|
1 | (16) |
|
|
2 | (5) |
|
|
7 | (2) |
|
Installing the SQL Server Documentation |
|
|
9 | (1) |
|
Installing a Sample Database |
|
|
10 | (5) |
|
Installing the Northwind Creation Script |
|
|
10 | (2) |
|
Creating the Northwind Sample Database |
|
|
12 | (2) |
|
Uninstalling the Northwind Creation Script |
|
|
14 | (1) |
|
|
15 | (2) |
|
Getting to Know Our Tools |
|
|
17 | (28) |
|
|
17 | (12) |
|
|
29 | (9) |
|
|
38 | (4) |
|
|
42 | (3) |
|
|
45 | (22) |
|
|
45 | (1) |
|
|
46 | (11) |
|
|
50 | (4) |
|
|
54 | (3) |
|
|
57 | (2) |
|
|
59 | (2) |
|
|
61 | (1) |
|
|
62 | (2) |
|
|
63 | (1) |
|
|
63 | (1) |
|
Character String Data Types |
|
|
63 | (1) |
|
|
64 | (1) |
|
|
64 | (1) |
|
|
65 | (1) |
|
|
65 | (1) |
|
|
66 | (1) |
|
|
67 | (30) |
|
|
67 | (3) |
|
|
67 | (1) |
|
ADO.NET Isn't a New Version of ADO |
|
|
68 | (1) |
|
ADO.NET and the .NET Base Class Library |
|
|
69 | (1) |
|
Understanding ADO.NET Architecture |
|
|
70 | (24) |
|
Using the SQL Server Data Provider |
|
|
73 | (7) |
|
Using the OLE DB Data Provider |
|
|
80 | (4) |
|
Using the ODBC Data Provider |
|
|
84 | (10) |
|
|
94 | (1) |
|
|
95 | (2) |
|
|
97 | (20) |
|
Introducing the Data Provider Connection Classes |
|
|
97 | (1) |
|
Connecting to SSE with SqlConnection |
|
|
98 | (9) |
|
Try It Out: Using SqlConnection |
|
|
98 | (2) |
|
|
100 | (3) |
|
Debugging Connections to SQL Server |
|
|
103 | (1) |
|
Security and Passwords in SqlConnection |
|
|
104 | (1) |
|
How to Use SQL Server Security |
|
|
105 | (1) |
|
Connection String Parameters for SqlConnection |
|
|
105 | (2) |
|
|
107 | (1) |
|
Improving Your Use of Connection Objects |
|
|
107 | (5) |
|
Using the Connection String in the Connection Constructor |
|
|
107 | (1) |
|
Displaying Connection Information |
|
|
107 | (1) |
|
Try It Out: Displaying Connection Information |
|
|
108 | (1) |
|
|
109 | (3) |
|
Connecting to SSE with OleDbConnection |
|
|
112 | (3) |
|
Try It Out: Connecting to SSE with the OLE DB Data Provider |
|
|
113 | (1) |
|
|
114 | (1) |
|
|
115 | (2) |
|
|
117 | (24) |
|
|
118 | (5) |
|
Try It Out: Creating a Command with a Constructor |
|
|
118 | (1) |
|
|
119 | (1) |
|
Associating a Command with a Connection |
|
|
119 | (2) |
|
Assigning Text to a Command |
|
|
121 | (2) |
|
|
123 | (3) |
|
Try It Out: Using the ExecuteScalar Method |
|
|
123 | (2) |
|
|
125 | (1) |
|
Executing Commands with Multiple Results |
|
|
126 | (3) |
|
Try It Out: Using the ExecuteReader Method |
|
|
126 | (2) |
|
|
128 | (1) |
|
|
129 | (4) |
|
Try It Out: Using the ExecuteNonQuery Method |
|
|
129 | (2) |
|
|
131 | (2) |
|
|
133 | (5) |
|
Try It Out: Using Command Parameters |
|
|
134 | (3) |
|
|
137 | (1) |
|
|
138 | (1) |
|
|
139 | (2) |
|
|
141 | (28) |
|
Understanding Data Readers in General |
|
|
141 | (14) |
|
Try It Out: Looping Through a Result Set |
|
|
142 | (2) |
|
|
144 | (1) |
|
|
145 | (1) |
|
Try It Out: Using Ordinal Indexers |
|
|
145 | (2) |
|
|
147 | (1) |
|
Using Column Name Indexers |
|
|
148 | (1) |
|
Using Typed Accessor Methods |
|
|
149 | (3) |
|
Try It Out: Using Typed Accessor Methods |
|
|
152 | (2) |
|
|
154 | (1) |
|
|
155 | (5) |
|
Try It Out: Getting Information About a Result Set with a Data Reader |
|
|
156 | (3) |
|
|
159 | (1) |
|
Getting Data About Tables |
|
|
160 | (4) |
|
Try It Out: Getting Schema Information |
|
|
161 | (2) |
|
|
163 | (1) |
|
Using Multiple Result Sets with a Data Reader |
|
|
164 | (4) |
|
Try It Out: Handling Multiple Result Sets |
|
|
165 | (2) |
|
|
167 | (1) |
|
|
168 | (1) |
|
Introducing Datasets and Data Adapters |
|
|
169 | (52) |
|
Understanding the Object Model |
|
|
170 | (4) |
|
Datasets vs. Data Readers |
|
|
170 | (1) |
|
A Brief Introduction to Datasets |
|
|
170 | (2) |
|
A Brief Introduction to Data Adapters |
|
|
172 | (2) |
|
Working with Datasets and Data Adapters |
|
|
174 | (37) |
|
Try It Out: Populating a Dataset with a Data Adapter |
|
|
174 | (2) |
|
|
176 | (2) |
|
Filtering and Sorting in a Dataset |
|
|
178 | (10) |
|
Modifying Data in a Dataset |
|
|
188 | (3) |
|
Propagating Changes to a Data Source |
|
|
191 | (20) |
|
|
211 | (1) |
|
|
212 | (3) |
|
Try It Out: Extracting a Dataset to an XML File |
|
|
212 | (2) |
|
|
214 | (1) |
|
Using Data Tables Without Datasets |
|
|
215 | (3) |
|
Try It Out: Populating a Data Table with a Data Adapter |
|
|
215 | (2) |
|
|
217 | (1) |
|
Understanding Typed and Untyped Datasets |
|
|
218 | (1) |
|
|
219 | (2) |
|
|
221 | (22) |
|
|
221 | (1) |
|
Performing Simple Data Binding |
|
|
222 | (2) |
|
Try It Out: Using Simple Data Binding |
|
|
222 | (1) |
|
|
223 | (1) |
|
Performing Complex Data Binding |
|
|
224 | (6) |
|
Try It Out: Using Complex Data Binding |
|
|
225 | (5) |
|
|
230 | (1) |
|
Understanding Data Binding: Behind the Scenes |
|
|
230 | (1) |
|
Synchronizing Controls with a Data Source |
|
|
231 | (5) |
|
Try It Out: Using a Binding Manager |
|
|
232 | (3) |
|
|
235 | (1) |
|
Updating from a Data Grid |
|
|
236 | (5) |
|
Try It Out: Updating a Table Using a Data Grid |
|
|
236 | (3) |
|
|
239 | (2) |
|
|
241 | (2) |
|
Understanding Tables and Relationships |
|
|
243 | (24) |
|
|
243 | (1) |
|
|
244 | (5) |
|
Creating a Table with SSMSE |
|
|
244 | (2) |
|
Creating a Table with SQL |
|
|
246 | (3) |
|
|
249 | (3) |
|
Dropping a Table with SSMSE |
|
|
250 | (1) |
|
Dropping a Table with SQL |
|
|
251 | (1) |
|
Relationships Between Tables |
|
|
252 | (3) |
|
|
254 | (1) |
|
|
255 | (9) |
|
|
255 | (2) |
|
|
257 | (2) |
|
Testing Entity and Referential Integrity |
|
|
259 | (5) |
|
|
264 | (1) |
|
|
265 | (2) |
|
Learning More About Queries |
|
|
267 | (34) |
|
|
267 | (1) |
|
|
268 | (2) |
|
Try It Out: Querying Using Distinct |
|
|
268 | (1) |
|
|
269 | (1) |
|
|
270 | (1) |
|
|
270 | (5) |
|
Try It Out: Using the IN Predicate |
|
|
271 | (1) |
|
|
272 | (1) |
|
Try It Out: Using the Not IN Predicate |
|
|
272 | (1) |
|
|
273 | (1) |
|
Try It Out: Using a Function with the IN Predicate |
|
|
274 | (1) |
|
|
274 | (1) |
|
|
275 | (1) |
|
Try It Out: Using the Group By Clause |
|
|
275 | (1) |
|
|
276 | (1) |
|
|
276 | (2) |
|
Try It Out: Using the MIN, MAX, and AVG Functions |
|
|
277 | (1) |
|
|
278 | (1) |
|
|
278 | (2) |
|
Try It Out: Using T-SQL Date and Time Functions |
|
|
278 | (1) |
|
|
279 | (1) |
|
|
280 | (4) |
|
|
280 | (1) |
|
Try It Out: Using a Simple Case Expression |
|
|
280 | (1) |
|
|
281 | (1) |
|
Try It Out: Using a More Complex Case Expression |
|
|
282 | (1) |
|
|
283 | (1) |
|
Searched Case Expressions |
|
|
284 | (2) |
|
Try It Out: Using a Searched Case Expression |
|
|
284 | (1) |
|
|
285 | (1) |
|
|
286 | (14) |
|
|
286 | (1) |
|
Try It Out: Writing an Inner Join |
|
|
287 | (1) |
|
|
288 | (1) |
|
Try It Out: Writing an Inner Join Using Correlation Names |
|
|
289 | (1) |
|
|
290 | (1) |
|
Try It Out: Writing an Inner Join Using Correlation Names and Aliases |
|
|
291 | (1) |
|
|
292 | (1) |
|
Try It Out: Coding an Inner Join Using Original Syntax |
|
|
292 | (1) |
|
|
293 | (1) |
|
Try It Out: Writing an Inner Join of Three Tables |
|
|
294 | (1) |
|
|
295 | (1) |
|
|
296 | (1) |
|
Try It Out: Adding an Employee with No Orders |
|
|
296 | (1) |
|
|
297 | (1) |
|
Try It Out: Using Left Outer Join |
|
|
297 | (1) |
|
|
298 | (1) |
|
|
299 | (1) |
|
|
300 | (1) |
|
|
301 | (22) |
|
Creating Stored Procedures |
|
|
301 | (10) |
|
Try It Out: Creating and Executing a Trivial Stored Procedure |
|
|
302 | (4) |
|
|
306 | (1) |
|
Try It Out: Creating a Stored Procedure with an Input Parameter |
|
|
307 | (1) |
|
|
308 | (1) |
|
Try It Out: Creating a Stored Procedure with an Output Parameter |
|
|
309 | (1) |
|
|
310 | (1) |
|
Modifying Stored Procedures |
|
|
311 | (2) |
|
Try It Out: Modifying Our Trivial Stored Procedure |
|
|
311 | (2) |
|
|
313 | (1) |
|
Deleting Stored Procedures |
|
|
313 | (1) |
|
Try It Out: Modifying Our Trivial Stored Procedure |
|
|
313 | (1) |
|
|
314 | (1) |
|
Working with Stored Procedures in Visual Basic |
|
|
314 | (7) |
|
Try It Out: Executing a Stored Procedure with No Input Parameters |
|
|
315 | (1) |
|
|
316 | (1) |
|
Try It Out: Executing a Stored Procedure with Parameters |
|
|
317 | (3) |
|
|
320 | (1) |
|
|
321 | (2) |
|
|
323 | (22) |
|
Handling ADO.NET Exceptions |
|
|
323 | (9) |
|
Try It Out: Handling an ADO.NET Exception (Part 1) |
|
|
323 | (4) |
|
|
327 | (1) |
|
Try It Out: Handling an ADO.NET Exception (Part 2) |
|
|
328 | (3) |
|
|
331 | (1) |
|
Handling Database Exceptions |
|
|
332 | (11) |
|
Try It Out: Handling a Database Exception (Part 1): Raiserror |
|
|
334 | (2) |
|
|
336 | (2) |
|
Try It Out: Handling a Database Exception (Part 2): Stored Procedure Error |
|
|
338 | (2) |
|
|
340 | (1) |
|
Try It Out: Handling a Database Exception (Part 3): Errors Collection |
|
|
340 | (2) |
|
|
342 | (1) |
|
|
343 | (2) |
|
|
345 | (20) |
|
|
345 | (1) |
|
Understanding ACID Properties |
|
|
346 | (1) |
|
|
347 | (17) |
|
Coding Transactions in T-SQL |
|
|
348 | (11) |
|
Coding Transactions in ADO.NET |
|
|
359 | (5) |
|
Suggestions for Further Study |
|
|
364 | (1) |
|
|
364 | (1) |
|
Working with ADO.NET Events |
|
|
365 | (22) |
|
|
365 | (1) |
|
Adding and Removing Event Handlers |
|
|
366 | (1) |
|
Raising and Handling ADO.NET Events |
|
|
366 | (19) |
|
Working with Connection Object Events |
|
|
366 | (9) |
|
Working with RowUpdate Events |
|
|
375 | (6) |
|
Working with Multiple Handlers |
|
|
381 | (4) |
|
|
385 | (2) |
|
Working with Text and Binary Data |
|
|
387 | (24) |
|
Understanding SQL Server Text and Binary Data Types |
|
|
387 | (1) |
|
Storing Images in a Database |
|
|
388 | (7) |
|
Try It Out: Loading Image Binary Data from Files |
|
|
389 | (3) |
|
|
392 | (3) |
|
|
395 | (1) |
|
Retrieving Images from a Database |
|
|
395 | (5) |
|
Try It Out: Displaying Stored Images |
|
|
395 | (3) |
|
|
398 | (2) |
|
|
400 | (6) |
|
Try It Out: Loading Text Data from a File |
|
|
400 | (4) |
|
|
404 | (2) |
|
Retrieving Data from Text Columns |
|
|
406 | (3) |
|
Try It Out: Retrieving Text Data |
|
|
406 | (2) |
|
|
408 | (1) |
|
|
409 | (2) |
|
|
411 | (26) |
|
|
411 | (1) |
|
Understanding XML Documents |
|
|
412 | (2) |
|
Understanding the XML Declaration |
|
|
414 | (1) |
|
|
414 | (8) |
|
Try It Out: Creating Some Sample Data |
|
|
415 | (2) |
|
|
417 | (1) |
|
Try It Out: Using For XML Raw |
|
|
418 | (1) |
|
|
419 | (1) |
|
Try It Out: Using For XML Auto |
|
|
419 | (1) |
|
|
420 | (1) |
|
Try It Out: Using For XML Auto Again |
|
|
420 | (1) |
|
|
421 | (1) |
|
|
422 | (7) |
|
Try It Out: Using OpenXml |
|
|
423 | (2) |
|
|
425 | (2) |
|
Try It Out: Generating an Edge Table |
|
|
427 | (1) |
|
|
428 | (1) |
|
|
429 | (7) |
|
Try It Out: Creating a Table to Store XML |
|
|
429 | (1) |
|
|
430 | (1) |
|
Try It Out: Storing and Retrieving XML Documents |
|
|
430 | (1) |
|
|
431 | (1) |
|
Try It Out: Using OpenXml with XML Columns |
|
|
432 | (1) |
|
|
433 | (1) |
|
Try It Out: Using an Element-centric Schema with OpenXml |
|
|
434 | (1) |
|
|
435 | (1) |
|
|
436 | (1) |
|
|
437 | (26) |
|
|
438 | (1) |
|
|
439 | (5) |
|
|
444 | (9) |
|
Try It Out: Coding a Simple Linq to SQL Query |
|
|
444 | (2) |
|
|
446 | (3) |
|
Try It Out: Using the Where Clause |
|
|
449 | (1) |
|
|
450 | (1) |
|
Try It Out: Using the Order By Clause |
|
|
450 | (2) |
|
|
452 | (1) |
|
|
453 | (9) |
|
Try It Out: Coding a Simple Linq to DataSet Query |
|
|
453 | (2) |
|
|
455 | (1) |
|
Try It Out: Using Linq to DataSet with a Typed Dataset |
|
|
456 | (4) |
|
|
460 | (2) |
|
|
462 | (1) |
Index |
|
463 | |