ADO.NET 3.5 Cookbook



ADO.NET 3.5 Cookbook

One reason I often buy a book is because it solves a particular problem I am having writing an application; solving one problem in the middle of a project can easily be worth the price of a book (which is why I like the whole O Reilly series of Cookbooks).


For example, let s look at the first recipe in Bill Hamilton s ADO.NET 3.5 Cookbook, Storing Connection Strings. If you are new to .NET database programming (and maybe even if you are not so new), you need to know how to store database connection strings. In .NET you have a number of options as to where to store connection strings. What are they, and which one is right for your situation? This recipe covers storing connection strings in the application, the registry, Universal Data Link files (UDL), and custom files. This section explains the advantages and disadvantages, security ramifications, and ease of modifying each; it also provides detailed instructions on how to use each of the preferred options. The book continues to do this for more than two hundred recipes divided into twelve chapters.


The first chapter covers connecting to databases, including connecting to databases using Excel and text files, and how to use connection pooling. Chapter 2 details working with disconnected data objects. Chapter 3 goes over retrieving data from databases, including hierarchical data; reading data from databases, text files, and Excel worksheets; and querying using LINQ. Chapter 4 explains how to search and analyze data, including sorting, filtering, recursive queries, and even how to access deleted rows (but only before AcceptChanges is called). Chapter 5 covers adding and modifying data.


Chapter 6 details copying and transferring data. It covers moving data between data tables, as well as between data tables, data sets, and data readers. It also explains how to serialize and deserialize data. It shows how to export the results of a query to a string or an array. As a bonus, it shows how to read and write from and to legacy ADO databases.


Chapter 7 details maintaining database integrity using transactions, checking for concurrency conflicts, resolving data conflicts, and using column expressions to enforce business rules. Chapter 8 has complete coverage of data binding in both Web Forms and Windows Forms. Chapter 9 covers XML data, including schemas, XPath, and SQL Server XML data.


Chapter 10 shows how to optimize data access in .NET with examples of executing multiple commands on a single connection, bulk loading and copying, batch updates, and working with large data from Oracle databases.


Chapter 11 explains how to work with database metadata, including retrieving metadata, and information on columns (length, default types, etc.). It details how to retrieve a SQL Server query plan (I didn t know you could do that with software). It shows how to create new databases and add tables and relationships to a database. It continues with how to enumerate different types of data providers (.NET, OLE DB, ODBC, SQL), and closes by showing how to programmatically change SQL Server passwords.


The final chapter covers CLR integration, which allows the use of .NET inside SQL Server, such as using C# or other .NET-compatible languages to create stored procedures. The book ends with an appendix that lists the changes in ADO.NET since version 1.0.


This Cookbook has an incredible 900+ pages of short examples showing how to perform specific tasks. If you are an experienced ADO.NET programmer, this book will pay for itself many times over by speeding you through everyday tasks. If you are learning ADO.NET, the best way is by writing ADO.NET code this book will keep you from getting stuck by showing not only the how, but the why of coding ADO.NET. Regardless of your skill level, this is a book you cannot afford to be without.


Dennis Hayes



Title: ADO.NET 3.5 Cookbook

Author: Bill Hamilton

Publisher: O Reilly

ISBN: 978-0-596-10140-4

Web Site:

Price: US$54.99

Page Count: 980



Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.