Tài liệu Professional ADO.NET 2 Programming with SQL Server 2005, Oracle and MySQL (P1) docx

30 484 0
Tài liệu Professional ADO.NET 2 Programming with SQL Server 2005, Oracle and MySQL (P1) docx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Professional ADO.NET 2 Programming with SQL Server 2005, Oracle®, and MySQL® Wallace B. McClure Gregory A. Beamer John J. Croft IV J. Ambrose Little Bill Ryan Phil Winstanley David Yack Jeremy Zongker 01_584375 ffirs.qxd 10/28/05 10:49 PM Page iii Professional ADO.NET 2 Programming with SQL Server 2005, Oracle®, and MySQL® 01_584375 ffirs.qxd 10/28/05 10:49 PM Page i 01_584375 ffirs.qxd 10/28/05 10:49 PM Page ii Professional ADO.NET 2 Programming with SQL Server 2005, Oracle®, and MySQL® Wallace B. McClure Gregory A. Beamer John J. Croft IV J. Ambrose Little Bill Ryan Phil Winstanley David Yack Jeremy Zongker 01_584375 ffirs.qxd 10/28/05 10:49 PM Page iii Professional ADO.NET 2 Programming with SQL Server 2005, Oracle®, and MySQL® Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN-13: 978-0-7645-8437-4 ISBN-10: 0-7645-8437-5 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/RW/RR/QV/IN Library of Congress Cataloging-in-Publication Data is available from the publisher. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355 or online at http://www.wiley.com/go/permissions. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HERE- FROM. THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAP- PEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ. For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Linux is a registered trademark of Linus Torvalds. MySQL is a registered trademark of MySQL AB A Company. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. 01_584375 ffirs.qxd 10/28/05 10:49 PM Page iv About the Authors Wallace B. McClure Wallace B. McClure graduated from the Georgia Institute of Technology in 1990 with a bachelor of science degree in electrical engineering. He continued his education there, receiving a master’s degree in the same field in 1991. Since that time, he has done consulting and development for such companies as Coca-Cola, Bechtel National, Magnatron, and Lucent Technologies, among others. Products and services have included work with ASP, ADO, XML, and SQL Server, as well as numerous applications in the Microsoft .NET Framework. Wally McClure specializes in building applications that have large numbers of users and large amounts of data. He is a Microsoft MVP and an ASPInsider, and a partner in Scalable Development, Inc. You can read Wally’s blog at http://weblogs.asp.net/wallym /. Gregory A. Beamer Gregory A. Beamer is a solutions architect specializing in Microsoft Internet technologies. Greg got involved in programming in the early 1990s with Visual Basic 3 and has stayed on the leading edge of Microsoft Internet technologies since the Denali beta (ASP 1.0). Greg first worked with .NET with the PDC 2000 beta and has been on both the SQL Server 2005 and .NET 2.0 betas since spring 2003. When Greg is not working, he spends his time with his wife, Tiffany, and their four daughters, Rebecca, Emily, Annabelle, and Miranda. John J. Croft IV John J. Croft IV graduated from the Georgia Institute of Technology in 1991, receiving a bachelor’s degree in mechanical engineering. He then spent five years consulting for large companies, including Coca-Cola, BellSouth, and MCI. Work at these companies primarily involved C and C++ programming and object-oriented systems analysis. His various clients have included both Fortune 100s and small startup companies. Their problems have ranged drastically, from large databases and executive informa- tion systems to lithotripter control and satellite telemetry. Croft has completed projects with Java, XML, and, recently, C# and .NET applications. He is a partner in Scalable Development, Inc. J. Ambrose Little Ambrose is the editor-in-chief of the ASPAlliance, an ASPInsider, and a Microsoft ASP.NET MVP who currently works as a Web architect for a large credit union in Tampa, Florida. Previously, he worked as a consultant at Verizon, creating XML Web Services and middle-tier components, and for BOK Financial’s Web Services department creating ASP.NET applications for their intranet. His pre-.NET programming experience consists mostly of developing Web applications using ASP and VB COM/DCOM for several years. He has a bachelor’s degree in medieval European history, which remains an interest. Apart from developing software, he enjoys movies, reading, writing, foosball, chess, tennis, badminton, and spend- ing time with his wonderful family. 01_584375 ffirs.qxd 10/28/05 10:49 PM Page v vi About the Authors Bill Ryan Bill currently works as a senior software developer for TiBA Solutions in Greenville, SC. He is also a Windows Embedded MVP, has served on Macromedia’s Flash Advisory Board, and helps run two popular .NET Focused Web sites ( www.devbuzz.com and www.knowdotnet.com ) and his blog www.msmvps.com/WilliamRyan . After earning his master’s degree in business administration, Bill began work as a statistical analyst, but quickly realized that his true love was programming. He has worked in multiple industries, including financial services/securities, manufacturing, health care, phar- maceuticals, and, currently, consulting. Bill is a frequent speaker at user’s group meetings, has spoken at multiple Microsoft Code Camps, and has hosted multiple MSDN Webcasts. Although technologically related things consume most of his time, Bill’s other interests include cult films, economics, Freemasonry, cuckoo clocks, and, most important, his girlfriend, Kim, and her daughter, Sarah. Phil Winstanley Phil Winstanley is a Web applications developer working for Portfolio Europe, located in Manchester, England. He has been involved with ASP.NET since its inception, and has developed a deep understand- ing of the platform. As a Microsoft MVP (Most Valuable Professional), member of the ASPInsiders, co-owner of Microsoft Web Developers UK, and the North West England Regional Director for the .NET Exchange, Phil is deeply embedded in the development community and works closely with the Web Platforms team at Microsoft, regularly visiting the developers in Redmond, Washington. David Yack David is the president of Colorado Technology Consultants, Inc. He is a hands-on technology consultant with solid management experience in privately held and Fortune 500 companies and has over 15 years of experience in the IT industry. David is currently responsible for leading Colorado Technology Consultants’ focus on Microsoft .NET technologies. David is an active participant in the Microsoft development community, ranging from the Denver .NET user group to Microsoft’s Public Communities, such as www.asp.net and http://aspalliance.com . David is the leader of the South Colorado .NET user group. David is recognized by Microsoft as a .NET MVP (Most Valuable Professional). Jeremy Zongker Jeremy Zongker is a software development manager who works primarily on data-driven ASP.NET applications with Microsoft SQL Server databases. He is a Microsoft Certified Solutions Developer for .NET and a 2004 MVP for ASP.NET. Jeremy is the founder and senior developer for Trilitech, LLC, a Broken Arrow, Oklahoma, software development company. 01_584375 ffirs.qxd 10/28/05 10:49 PM Page vi Credits Acquisitions Editor Bob Elliott Development Editor Gabrielle Nabi Production Editor William A. Barton Technical Editor Wiley - Dreamtech India Pvt Ltd Copy Editor Luann Rouff Editorial Manager Mary Beth Wakefield Vice President and Publisher Joseph B. Wikert Project Coordinator Michael Kruzil Graphics and Production Specialists Carrie Foster Denny Hager Jennifer Heleine Alicia B. South Quality Control Technicians Amanda Briggs John Greenough Media Development Specialists Angela Denny Kit Malone Travis Silvers Proofreading and Indexing TECHBOOKS Production Services 01_584375 ffirs.qxd 10/28/05 10:49 PM Page vii 01_584375 ffirs.qxd 10/28/05 10:49 PM Page viii [...]... Warning with Asynchronous Operations 26 5 26 6 26 7 26 9 27 1 27 2 27 5 27 6 Multiple Active Result Sets 27 6 What Is MARS Useful For? Technical Issues with MARS 27 7 27 7 Enumerating SQL Servers Connection Pooling Password Management Building a SQL Connection with the SqlConnectionStringBuilder Class 27 8 27 9 28 0 28 1 SQL Server Types (SqlTypes) 28 3 Structures Using SqlTypes Using SqlDbType Bulk Copy with SQL Server. .. 16: ADO.NET 2 and Open-Source Databases 405 405 405 406 4 12 4 12 418 418 419 422 422 422 425 426 426 427 428 428 428 430 4 32 4 32 436 438 460 464 465 465 Open Source and Licensing Databases 465 466 MySQL MaxDB (formerly SAPdb) Firebird Ingres PostgreSQL BerkeleyDB SQLite 466 477 485 4 92 497 5 02 508 Summary For More Information xxii 5 12 513 Contents Chapter 17: Oracle and ADO.NET 515 Choosing an Oracle. .. Information Chapter 9: T -SQL Language and Enhancements An In-Depth Look at T -SQL Structured Exception Handling OUTPUT Top X Common Table Expressions PIVOT UNPIVOT Ranking Summary For More Information 23 3 23 3 23 4 23 5 23 8 24 0 24 9 25 0 25 2 25 4 25 6 25 6 26 4 26 4 Chapter 10: ADO.NET Programming with SQL Server from a Client Application 26 5 SQL Server and ADO.NET Asynchronous Commands in ADO.NET BeginExecuteNonQuery... Provider Statistics SqlCacheDependency 28 4 28 7 29 0 29 1 29 2 29 3 xix Contents SqlCacheDependencyAdmin SqlDependency Summary For More Information Chapter 11: SQL Server 20 05 Server- Side Programming Extended Stored Procedures CLR Objects Set-Based Programming Procedural Programming Using CLR Objects Creating CLR Objects SQL Server Projects Assemblies and CLR Object Tables/Functions Triggers SqlTriggerContext... XmlReader Enhancements Designer Enhancements XML Designer XSL Debugging XSD Enhancements Security XPathDocument 120 120 120 121 121 122 123 124 124 124 125 126 127 128 Editing Validation Change Notification 128 131 133 XSLT Improvements Performance Where XML Is Heading 134 134 135 XPath 2. 0 XSLT 2. 0 and XQuery XML Views ObjectSpaces 135 135 136 136 Summary For More Information 137 137 Chapter 6: Transactions... Information Chapter 8: Building a Custom ADO.NET Data Provider A Brief Overview AdsConnection AdsConnectionStringBuilder AdsCommand AdsDataReader User Properties versus Active Directory Properties Other AdsDataReader Members AdsDataAdapter AdsFactory xviii 163 164 164 165 166 167 169 170 175 176 185 189 191 1 92 1 92 1 92 197 199 199 20 1 20 2 20 3 20 9 21 1 21 9 22 1 22 6 22 8 23 1 Contents Getting Ready for Use Summary... several chapters go beyond ADO.NET, focusing more on Microsoft SQL Server 20 05 This is because the two are very tightly related Many of the new features in ADO.NET 2. 0 are designed to be used with Microsoft SQL Server 20 05, and many of the new features found in SQL 20 05 require ADO.NET 2. 0 to get the most benefit from them It wouldn’t be practical to speak strictly about ADO.NET without providing some... (FLOAT (24 )) and FLOAT (FLOAT and DOUBLE PRECISION) NUMERIC and DECIMAL (DEC and DEC(p,s)) MONEY and SMALLMONEY BINARY, VARBINARY, IMAGE, and VARBINARY(MAX) (BINARY VARYING) Using BINARY to Store Flags BIT TIMESTAMP SQL_ VARIANT UNIQUEIDENTIFIER XML TABLE and CURSOR Data Types in ADO.NET and NET SqlTypes Other Alternatives Mapping SQL Server Data Types to NET Summary For More Information Chapter 5: ADO.NET. .. The Generic Factory Model Providers ADO.NET to the Rescue DbProviderFactories Generic Factory versus Specific Providers Pros Cons Writing a Helper Class Data Sources Connection Strings Connection String Collection Intelligent Connection Strings Provider-Specific Connection Strings xiv 22 22 23 23 24 24 25 26 26 28 30 30 31 31 32 33 34 35 35 37 37 39 39 40 40 41 42 43 44 46 47 47 47 48 51 53 54 54 55... the Database xx 29 7 29 7 300 300 301 301 3 02 3 02 303 303 304 306 310 311 311 313 313 314 318 319 324 324 326 327 327 328 328 329 329 330 331 331 3 32 334 336 337 338 341 343 Contents Creating an Endpoint Summary For More Information Chapter 12: Notification Services Major Components Subscription Management Application Event Provider Generator Distributor Instances and Applications Configuring the Instance . ffirs.qxd 10 /28 /05 10:49 PM Page iii Professional ADO. NET 2 Programming with SQL Server 20 05, Oracle , and MySQL 01_584375 ffirs.qxd 10 /28 /05 10:49 PM. Page i 01_584375 ffirs.qxd 10 /28 /05 10:49 PM Page ii Professional ADO. NET 2 Programming with SQL Server 20 05, Oracle , and MySQL Wallace B. McClure Gregory

Ngày đăng: 12/12/2013, 21:16

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan