Synopses & Reviews
Designed in the highly regarded O'Reilly Cookbook format, ADO.NET Cookbook is strikingly different from other books on the subject. It isn't bogged down with pages of didactic theory. The ADO.NET Cookbook focuses exclusively on providing developers with easy-to-find coding solutions to real problems.ADO.NET Cookbook is a comprehensive collection of over 150 solutions and best practices for everyday dilemmas. For each problem addressed in the book, there's a solution--a short, focused piece of code that programmers can insert directly into their applications.And ADO.NET Cookbook is more than just a handy compilation of cut-and-paste C# and VB.NET code. ADO.NET Cookbook offers clear explanations of how and why the code works, warns of potential pitfalls, and directs you to sources of additional information, so you can learn to adapt the problem-solving techniques to different situations. This is a painless way for developers who prefer to learn by doing to expand their skills and productivity, while solving the pressing problems they face every day.These time-saving recipes include vital topics like connecting to data, retrieving and managing data, transforming and analyzing data, modifying data, binding data to .NET user interfaces, optimizing .NET data access, enumerating and maintaining database objects, and maintaining database integrity.The diverse solutions presented here will prove invaluable over and over again, for ADO.NET programmers at all levels, from the relatively inexperienced to the most sophisticated.
Teach yourself how to use ADO.NET 4, the data access technology that helps you create data-focused software faster and easier. With STEP BY STEP, you set the pace -- building and practicing the skills you need, just when you need them!
Gain a firm understanding of the fundamental concepts and tools provided with ADO.NET 4.0, one feature at a time. With clear discussions and hands-on examples written in Visual Basic and C#, you'll move step-by-step through the learning process.
- Manage data and information in a database-like fashion -- without access to a database
- Connect to external data sources, including databases and other standard data formats
- Use Entity Framework to interact with underlying data stores
- Learn why LINQ is a popular tool for analyzing information retrieved by ADO.NET
- Drive information to end users by binding data directly to Windows Forms and Web Forms
- Go beyond the core functionality of ADO.NET to manipulate data in advanced ways
Your online learning resources include:
- Files for building skills and practicing the book's lessons
- Examples and code in both the Visual Basic and C# languages
- Fully searchable eBook
Teach yourself the fundamentals of ADO.NET 4 -- one step at a time. With this practical, learn-by-doing tutorial, you get the clear guidance and hands-on examples you need to start creating datacentric applications for Windows® and the Web.
Discover how to:
- Connect to external data sources, including databases and other data formats
- Use ADO.NET Entity Framework to interact with underlying data stores
- Build Entity Framework models with graphical design tools in Microsoft Visual Studio 2010
- Analyze information stored in ADO.NET with various LINQ providers
- Bind data directly to Windows Forms and Web Forms to drive information to users
- Manage disconnected or standalone data and information
- Go beyond the core functionality of ADO.NET to manipulate data in more advanced ways
Your step by step digital content includes:
- Practice exercises
- Fully searchable online edition of this book -- with unlimited access on the Web
About the Author
Bill Hamilton is the author of the highly praised ADO.NET Cookbook. He is an enterprise architect specializing in designing, developing and implementing enterprise applications using .NET and J2EE technologies. Over the last fifteen years, Bill has provided consulting services for B2B, B2C, B2E, enterprise application integration, portal initiatives, and custom application development for financial services, retail, professional services, and manufacturing clients. Bill is also the author of O'Reilly's NUnit Pocket Reference, the co-author of ADO.NET in a Nutshell, and also writes for Microsoft Developer Network.
Table of Contents
Preface; Who This Book Is For; What You Need to Use This Book; How This Book Is Organized; What Was Left Out; Conventions Used in This Book; About the Code; Configuration Files; Platform Notes; Comments and Questions; Acknowledgments; Chapter 1: Connecting to Data; 1.1 Introduction; 1.2 Connecting to an ODBC Data Source; 1.3 Connecting to a Microsoft Excel Workbook; 1.4 Connecting to a Password-Protected Access Database; 1.5 Connecting to a Secured Access Database; 1.6 Connecting to an Access Databasefrom ASP.NET; 1.7 Using an IP Address to Connect to SQL Server; 1.8 Connecting to a Named Instance of SQL Server or Microsoft Data Engine (MSDE); 1.9 Connecting to SQL Server Using Integrated Security from ASP.NET; 1.10 Connecting to an Oracle Database; 1.11 Connecting to Exchange or Outlook; 1.12 Writing Database-Independent Code; 1.13 Storing Connection Strings; 1.14 Using the Data Link Properties Dialog Box; 1.15 Monitoring Connections; 1.16 Taking Advantage of Connection Pooling; 1.17 Setting Connection Pooling Options; 1.18 Using Transactions with Pooled Connections; 1.19 Changing the Database for an Open Connection; 1.20 Connecting to a Text File; Chapter 2: Retrieving and Managing Data; 2.1 Introduction; 2.2 Retrieving Hierarchical Data into a DataSet; 2.3 Building a DataSet Programmatically; 2.4 Creating a Strongly Typed DataSet; 2.5 Processing a Batch SQL Statement; 2.6 Using a Web Service as a Data Source; 2.7 Accessing Deleted Rows in a DataTable; 2.8 Counting Records in a DataReader; 2.9 Mapping .NET Data Provider Data Types to .NET Framework Data Types; 2.10 Returning an Output Parameter Using a DataReader; 2.11 Raising and Handling Stored Procedure Errors; 2.12 Testing for No Records; 2.13 Retrieving Stored Procedure Return Values Using a DataReader; 2.14 Executing SQL Server User-Defined Scalar Functions; 2.15 Passing Null Values to Parameters; 2.16 Retrieving Update Errors; 2.17 Mapping Table and Column Names Between the Data Source and DataSet; 2.18 Displaying Columns from a Related DataTable; 2.19 Controlling the Names Used in a Strongly Typed DataSet; 2.20 Replacing Null Values in a Strongly Typed DataSet; 2.21 Retrieving Data from an Oracle Package; 2.22 Using Parameterized SQL Statements; 2.23 Querying Data Asynchronously with Message Queuing; Chapter 3: Searching and Analyzing Data; 3.1 Introduction; 3.2 Filtering and Sorting Data; 3.3 Using Expression Columns to Display Calculated Values; 3.4 Determining the Differences in Data Between Two DataSet Objects; 3.5 Navigating Between Parent and Child Records Using a DataRelation; 3.6 Localizing Client-Side Data in a Web Forms Application; 3.7 Combining Data in Tables from Heterogeneous Data Sources; 3.8 Using Expression Columns to Display Aggregate Values; 3.9 Finding Rows in a DataTable; 3.10 Finding Rows in a DataView; 3.11 Selecting the Top n Rows in a DataTable; 3.12 Getting Typed DataRows from DataViews; 3.13 Filtering for Null Values; 3.14 Executing Queries That Use COMPUTE BY; 3.15 Using the Shape Language to Retrieve Hierarchical Data; Chapter 4: Adding and Modifying Data; 4.1 Introduction; 4.2 Using Auto-Incrementing Columns Without Causing Conflicts; 4.3 Getting an Identity Column Value from SQL Server; 4.4 Getting an AutoNumber Value from Microsoft Access; 4.5 Getting a Sequence Value from Oracle; 4.6 Adding Parent/Child Rows with Auto-Incrementing Keys; 4.7 Adding Records with a GUID Primary Key; 4.8 Updating a Data Source with Data from a Different Data Source; 4.9 Updating a Primary Key Value; 4.10 Getting Stored Procedure Parameter Information at Runtime; 4.11 Updating a DataSet with a Many-to-Many Relationship; 4.12 Updating Server Data Using a Web Service; 4.13 Updating Server Data Using .NET Remoting; 4.14 Updating Data Asynchronously Using Message Queuing; 4.15 Overcoming Keyword Conflicts When Using CommandBuilders; Chapter 5: Copying and Transferring Data; 5.1 Introduction; 5.2 Copying Rows from One DataTable to Another; 5.3 Copying Tables from One DataSet to Another; 5.4 Converting a DataReader to a DataSet; 5.5 Serializing Data; 5.6 Deserializing Data; 5.7 Merging Data; 5.8 Transmitting a DataSet Securely; 5.9 Transferring Login Credentials Securely; 5.10 Loading an ADO Recordset into a DataSet; 5.11 Converting a DataSet to an ADO Recordset; 5.12 Exporting the Results of a Query as a String; 5.13 Exporting the Results of a Query to an Array; Chapter 6: Maintaining Database Integrity; 6.1 Introduction; 6.2 Creating a Class That Participates in an Automatic Transaction; 6.3 Using Manual Transactions; 6.4 Nesting Manual Transactions with the SQL Server .NET Data Provider; 6.5 Using ADO.NET and SQL Server DBMS Transactions Together; 6.6 Using a Transaction with a DataAdapter; 6.7 Avoiding Referential Integrity Problems When Updating the Data Source; 6.8 Enforcing Business Rules with Column Expressions; 6.9 Creating Constraints, PrimaryKeys, Relationships Based on Multiple Columns; 6.10 Retrieving Constraints from a SQL Server Database; 6.11 Checking for Concurrency Violations; 6.12 Resolving Data Conflicts; 6.13 Using Transaction Isolation Levels to Protect Data; 6.14 Implementing Pessimistic Concurrency Without Using Database Locks; 6.15 Specifying Locking Hints in a SQL Server Database; Chapter 7: Binding Data to .NET User Interfaces; 7.1 Introduction; 7.2 Binding Simple Data to Web Forms Controls; 7.3 Binding Complex Data to Web Forms Controls; 7.4 Binding Data to a Web Forms DataList; 7.5 Binding Data to a Web Forms DataGrid; 7.6 Editing and Updating Data in a Web Forms DataGrid; 7.7 Synchronizing Master-Detail Web Forms DataGrids; 7.8 Displaying an Image from a Database in a Web Forms Control; 7.9 Displaying an Image from a Database in a Windows Forms Control; 7.10 Binding a Group of Radio Buttons in a Windows Form; 7.11 Creating Custom Columns in a Windows Forms DataGrid; 7.12 Populating a Windows Forms ComboBox; 7.13 Binding a Windows DataGrid to Master-Detail Data; 7.14 Loading a Windows PictureBox with Images Stored by Access as OLE Objects; 7.15 Using a DataView to Control Edits, Deletions, or Additions in Windows Forms; 7.16 Adding Search Capabilities to Windows Forms; 7.17 Dynamically Creating Crystal Reports; 7.18 Using ADO.NET Design-Time Features in Classes Without a GUI; Chapter 8: Working with XML; 8.1 Introduction; 8.2 Using XSD Schema Files to Load and Save a DataSet Structure; 8.3 Saving and Loading a DataSet from XML; 8.4 Synchronizing a DataSet with an XML Document; 8.5 Storing XML to a Database Field; 8.6 Reading XML Data Directly from SQL Server; 8.7 Using XPath to Query Data in a DataSet; 8.8 Transforming a DataSet Using XSLT; 8.9 Creating an XML File That Shows Changes Made to a DataSet; 8.10 Formatting Column Values When Outputting Data as XML; 8.11 Filling a DataSet Using an XML Template Query; 8.12 Using a Single Stored Procedure to Update Multiple Changes to a SQL Server Database; Chapter 9: Optimizing .NET Data Access; 9.1 Introduction; 9.2 Filling a DataSet Asynchronously; 9.3 Canceling an Asynchronous Query; 9.4 Caching Data; 9.5 Improving Paging Performance; 9.6 Performing a Bulk Insert with SQL Server; 9.7 Improving DataReader Performance with Typed Accessors; 9.8 Improving DataReader Performance with Column Ordinals; 9.9 Debugging a SQL Server Stored Procedure; 9.10 Improving Performance While Filling a DataSet; 9.11 Retrieving a Single Value from a Query; 9.12 Reading and Writing Binary Data with SQL Server; 9.13 Reading and Writing Binary Data with Oracle; 9.14 Performing Batch Updates with a DataAdapter; 9.15 Refreshing a DataSet Automatically Using Extended Properties; Chapter 10: Enumerating and Maintaining Database Objects; 10.1 Introduction; 10.2 Listing SQL Servers; 10.3 Retrieving Database Schema Information from SQL Server; 10.4 Retrieving Column Default Values from SQL Server; 10.5 Determining the Length of Columns in a SQL Server Table; 10.6 Counting Records; 10.7 Creating a New Access Database; 10.8 Creating a New SQL Server Database; 10.9 Adding Tables to a Database; 10.10 Getting a SQL Server Query Plan; 10.11 Compacting an Access Database; 10.12 Creating DataSet Relationships from SQL Server Relationships; 10.13 Getting SQL Server Column Metadata Without Returning Data; 10.14 Listing Installed OLE DB Providers; 10.15 Listing Tables in an Access Database; 10.16 Creating a Table in the Database from a DataTable Schema; 10.17 Listing Installed ODBC Drivers; Converting from C# to VB Syntax; General Considerations; Classes; Structures; Interfaces; Class, Structure, and Interface Members; Delegates; Enumerations; Colophon;