Informacje podstawowe:
- Wydawnictwo: O'Reilly Media
- Data wydania: 28 marca 2008
- Liczba stron: 992
- Autor/autorzy:
Opis:
As part of our highly regarded Cookbook format, this guide is strikingly different from other books on Microsoft's ADO.NET technology. Rather than theory, the "ADO.NET Cookbook" provides you with easy-to-find coding solutions to real problems. Yet, it's more than just a handy compilation of cut-and-paste C# and VB.NET code. This Cookbook offers clear explanations of how and why the code works, warns of potential pitfalls, and directs you to sources of additional information, so that you can learn to adapt the problem-solving techniques to different situations.
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. "ADO.NET Cookbook" offers a painless way for you to learn by doing so you can expand your skills and productivity, while solving the pressing problems you face every day. It's ideal for all ADO.NET programmers no matter what your technical level, whether you're an old hand or relatively inexperienced.
O autorze/autorach:
Bill Hamilton
Bill Hamilton is a technology and management consultant who specializes in assessing business objectives and company processes and designing and restructuring technology strategy and enterprise architecture. Bill has been designing and implementing enterprise solutions using both SQL Server and Oracle for over a decade. Bill is the author of other O'Reilly titles including the highly praised Programming SQL Server 2005 and ADO.NET Cookbook, and he also writes for the Microsoft Developer Network. You can email Bill at bill.hamilton@element14.com.
View Bill Hamilton's full profile page.
Zawartość (spis treści):
Chapter 1 Connecting to Data
- Introduction
- Storing Connection Strings
- Building a Connection String
- Connecting to SQL Server
- Connecting to a Named Instance of SQL Server
- Connecting to SQL Server Using an IP Address
- Connecting to SQL Server Using Integrated Security from ASP.NET
- Connecting to an Oracle Database
- Connecting to an OLE DB Data Source
- Connecting to an ODBC Data Source
- Connecting to a Microsoft Access Database
- Connecting to a Password-Protected Microsoft Access Database
- Connecting to a Microsoft Access Database from ASP.NET
- Connecting to a Microsoft Excel Workbook
- Connecting to a Text File
- Changing the Database for an Open Connection
- Setting Connection Pooling Options
- Taking Advantage of Connection Pooling
- Using Transactions with Pooled Connections
- Displaying a Connection Property Dialog Box
- Displaying the Data Link Properties Dialog Box
- Monitoring Connections
Chapter 2 Working with Disconnected Data Objects
- Introduction
- Creating a DataColumn and Adding It to a DataTable
- Creating a DataTable and Adding It to a DataSet
- Mapping Table and Column Names Between a Data Source and DataSet
- Mapping .NET Data Provider Data Types to .NET Framework Data Types
- Adding a Calculated Column to a DataTable
- Creating a Unique Constraint
- Creating Single- and Multi-Column Primary Keys
- Creating an Autoincrementing Primary Key
- Creating a Foreign Key Constraint
- Creating a Data Relation
- Building a DataSet Programmatically
- Adding a Column to a Child DataTable That Displays Data from the Parent Table
- Adding a Column to a Parent DataTable That Aggregates a Child Table's Column Values
- Converting Between a DataTable and a DataRow Array
- Accessing Data Values in a DataRow Array
- Creating a Strongly Typed DataSet
- Controlling the Names Used in a Strongly Typed DataSet
- Replacing Null Values in a Strongly Typed DataSet
Chapter 3 Querying and Retrieving Data
- Introduction
- Executing a Query That Does Not Return a Result Set
- Executing a Query That Returns a Single Value
- Retrieving a Result Set Stream Using a DataReader
- Accessing Data Values in a DataReader
- Retrieving a Result Set Using a DataTable or a DataSet
- Accessing Data Values in a DataTable or DataSet
- Working with Data in a Strongly Typed DataSet
- Working with Parent-Child Relations in a Strongly Typed DataSet
- Using a DataView with a Strongly Typed DataSet
- Testing Whether a Query Returns an Empty Result Set
- Counting Records Meeting Criteria
- Determining the Number of Records Returned in a DataReader
- Executing a Query That Returns Multiple Result Sets
- Retrieving Schema and Constraints for a DataSet
- Retrieving Hierarchical Data
- Navigating Between Parent and Child Tables in an Untyped DataSet
- Executing a Parameterized Query
- Retrieving Data Using a SQL Server Stored Procedure
- Retrieving Multiple Result Sets Using the Oracle Provider
- Passing a Null Value to a Query Parameter
- Using Table-Valued Types As Parameters
- Retrieving a Return Value from a Stored Procedure
- Retrieving a Stored Procedure Output Parameter
- Raising and Handling Stored Procedure Errors
- Executing a SQL Server Scalar-Valued Function
- Executing a SQL Server Table-Valued Function
- Querying a DataSet Using LINQ
- Querying a SQL Server Database Using LINQ
- Retrieving Data from a Text File
- Retrieving Data from a Microsoft Excel Workbook
- Querying Data Asynchronously with Message Queuing
Chapter 4 Searching and Analyzing Data
- Introduction
- Determining the Differences in Data Between Two DataSet Objects
- Combining Data from Heterogeneous Data Sources
- Filtering Rows in a DataTable or DataView
- Finding Rows in a DataTable or DataView
- Filtering and Sorting Data in a DataTable
- Filtering Null Field Values in a DataTable
- Accessing Deleted Rows in a DataTable
- Selecting the Top N Rows in a DataTable
- Executing Queries That Use COMPUTE BY
- Using the Shape Language to Retrieve Hierarchical Data
- Retrieving a Random Sample of Records
- Using a Common Table Expression (CTE)
- Executing a Recursive Query
- Retrieving a Ranked Result Set
- Retrieving a Pivot and Unpivot Table
- Invoking a Function for Each Row in a Result Set
Chapter 5 Adding and Modifying Data
- Introduction
- Using Autoincrementing Columns Without Causing Conflicts
- Getting an Identity Column Value from SQL Server
- Getting an AutoNumber Value from Microsoft Access
- Getting a Sequence Value from Oracle
- Modifying Data in a Microsoft Excel Workbook
- Modifying Data in a Text File
- Retrieving Update Errors
- Adding Parent/Child Rows with Autoincrementing Keys
- Adding Records with a GUID Primary Key
- Inserting Multiple Rows into a Database Table Using T-SQL Row Constructors
- Updating a Data Source with Data from a Different Data Source
- Updating a Primary Key Value
- Getting Stored Procedure Parameter Information at Runtime
- Updating a DataSet with a Many-to-Many Relationship
- Updating Data Asynchronously Using Message Queuing
- Controlling Edits, Deletions, or Additions to Data with a DataView
- Overcoming Keyword Conflicts When Using a CommandBuilder
- Capturing Changes to Data in a SQL Server Database
Chapter 6 Copying and Transferring Data
- Introduction
- Copying Rows from One DataTable to Another
- Copying Tables from One DataSet to Another
- Converting a DataReader to a DataTable
- Converting a DataReader to a DataSet
- Converting a DataTable to a DataReader
- Converting a DataSet to a DataReader
- Serializing Data
- Deserializing Data
- Merging Data in Two DataSet Objects
- Merging Data in Two Database Tables
- Encrypting a DataSet
- Securing Login Credentials
- Exporting the Results of a Query As a String
- Exporting the Results of a Query to an Array
- Loading an ADO Recordset into a DataSet
- Converting a DataSet to an ADO Recordset
Chapter 7 Maintaining Database Integrity
- Introduction
- Using Distributed Transactions
- Using Manual Transactions
- Nesting Manual Transactions with the SQL Server .NET Data Provider
- Using ADO.NET and SQL Server DBMS Transactions Together
- Using a Transaction with a DataAdapter
- Avoiding Referential Integrity Problems when Updating Data in Related Tables
- Enforcing Business Rules with Column Expressions
- Retrieving Constraints from a SQL Server Database
- Checking for Concurrency Violations
- Resolving Data Conflicts
- Using Transaction Isolation Levels to Protect Data
- Specifying Locking Hints in a SQL Server Database
Chapter 8 Programmatically Working with Data in .NET Windows and Web Forms User Interfaces
- Introduction
- Loading Data into and Binding a Field to a Web Forms Control
- Binding Data to a Web Forms Control
- Binding Data to a Web Forms DetailsView Control
- Binding Data to a Web Forms Repeater Control
- Binding Data to a Web Forms DataList Control
- Binding Data to a Web Forms GridView Control
- Modifying and Updating Data in a Web Forms GridView Control
- Binding Data to a Web Forms FormView Control
- Synchronizing Master-Detail Data in a Web Forms Application
- Displaying an Image from a Database in a Web Forms Control
- Localizing Client-Side Data in a Web Forms Application
- Loading Data into and Binding a Field to a Windows Forms Control
- Binding Data to a Windows Forms Control
- Binding Data to a Windows Forms DataGridView Control
- Modifying and Updating Data in a Windows Forms DataGridView Control
- Using Windows Forms BindingNavigator and BindingSource Controls
- Synchronizing Master-Detail Data in a Windows Forms Application
- Displaying an Image from a Database in a Windows Forms Control
- Binding a Group of Radio Buttons to a Windows Forms Data Field
- Searching a Windows Forms DataGridView Control
Chapter 9 Working with XML Data
- Introduction
- Using an XML File to Save and Load a DataSet or a DataTable
- Using XSD Schema Files to Save and Load a DataSet Structure
- Formatting Column Values When Saving Data As XML
- Creating an XML File That Shows Changes Made to a DataSet
- Synchronizing a DataSet and an XML Document
- Storing and Retrieving XML with a Non-XML Data Type Column
- Working with a SQL Server XML Data Type Column
- Using an XPath Query to Retrieve Data
- Reading XML Data Directly from SQL Server
- Transforming a DataSet Using XSLT
- Filling a DataSet Using an XML Template Query
- Using OpenXML to Update Multiple Changes to SQL Server
Chapter 10 Optimizing .NET Data Access
- Introduction
- Executing Multiple Commands on a Single Connection
- Executing a SQL Statement Asynchronously
- Executing Simultaneous SQL Statements Asynchronously
- Creating a DataReader Asynchronously
- Filling a DataSet Asynchronously
- Canceling an Asynchronous Query
- Caching Data
- Improving Paging Performance
- XML Bulk Loading with SQL Server
- Bulk Copying with SQL Server
- Improving DataReader Performance with Typed Accessors
- Improving DataReader Performance with Column Ordinals
- Debugging a SQL Server Stored Procedure
- Improving Performance While Filling a DataSet
- Reading and Writing Large-Value Data with SQL Server
- Reading and Writing a SQL Server User-Defined Type (UDT)
- Reading and Writing Oracle Large Data
- Performing Batch Updates with a DataAdapter
- Automatically Refreshing a DataTable Periodically
- Automatically Refreshing a DataTable When Underlying Data Changes
- Retrieving SQL Server Runtime Statistics
- Writing Provider- and Database-Independent Code
Chapter 11 Enumerating and Maintaining Database Objects
- Introduction
- Enumerating SQL Servers
- Retrieving Database Metadata
- Retrieving Database Schema Information from SQL Server
- Retrieving Column Default Values from SQL Server
- Determining the Length of Columns in a SQL Server Table
- Retrieving a SQL Server Query Plan
- Retrieving SQL Server Column Metadata Without Returning Data
- Creating a New SQL Server Database
- Adding a Table to a SQL Server Database
- Creating a Database Table from a DataTable Schema
- Creating DataSet Relationships from SQL Server Relationships
- Creating a New Microsoft Access Database
- Listing Tables in an Access Database
- Enumerating .NET Data Providers
- Enumerating OLE DB Providers
- Enumerating ODBC Drivers
- Changing a SQL Server User Password
Chapter 12 SQL Server CLR Integration
- Introduction
- Creating a Stored Procedure
- Creating a Scalar-Valued Function
- Creating a Table-Valued Function
- Creating an Aggregate Function
- Creating a User-Defined Type
- Creating a DML Trigger
- Creating a DDL Trigger
AppendixWhat's New in ADO.NET Since Version 1.0
- ADO.NET 2.0
- ADO.NET 3.5
Colophon