Home > Store

Pragmatic ADO.NET: Data Access for the Internet World

Register your product to gain access to bonus material or receive a coupon.

Pragmatic ADO.NET: Data Access for the Internet World


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2003
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 384
  • Edition: 1st
  • Book
  • ISBN-10: 0-201-74568-2
  • ISBN-13: 978-0-201-74568-9

Developers need a way to interact with all data platforms in a uniform way, and Microsoft has attempted time and again to meet this need with its Universal Data Access strategy. In developing ADO.NET, Microsoft has made their additions of support for XML and disconnected data sets easier to use. This tutorial will guide the reader through ADO.NET from the top down, showing readers the hows and whys of using ADO.NET with lots of examples they can mold into their own projects right away. It is intended to be an introduction to ADO.NET for developers with some knowledge of data access. While it will show readers how ADO.NET follows on its predecessors, it will be written to avoid repeating any remedial instruction in databases and storage theory.

Sample Content

Online Sample Chapter

Typed DataSets in ADO.NET

Downloadable Sample Chapter

Click below for Sample Chapter(s) related to this title:
Sample Chapter 6

Table of Contents

(NOTE: Each chapter concludes with a Conclusion.)





1. Why ADO.NET.

A Short History of Universal Data Access.

Why ADO.NET Is a Better Data Access Layer.

A Short Course in ADO.NET.

2. Getting Connected with ADO.NET.

First Impressions.


Getting OLE DB Database Schema Information.

Error Handling in .NET.

3. Commanding the Database.


Executing Commands.

Database Transactions in ADO.NET.

Batch Queries.

4. Reading Data.

Reading Data.

The DataReader.

Putting It All Together.


5. Constructing DataSets.

What is a Dataset.

Filling Datasets.

Defining DataSet Schema.

6. Typed DataSets.

What Are Typed DataSets?

Generating Typed DataSets.

Using Typed DataSets.

Simplification of Business Object Layers.

7. Working with DataSets.

Changing the Data.

Navigating the DataSet.

Searching the DataSet.

Merging DataSets.

8. Updating the Database.

The Trouble with Disconnected Data.

Concurrency in ADO.NET.

Common Updating Issues.


9. ADO.NET and XML.

.NET and XML.

The DataSet and XML.

The XmlDataDocument Class.

10. Data Binding with ADO.NET.

What is Data Binding in .NET?

Data Binding in Windows Forms.

Data Binding in ASP.NET.

11. Scalability and Performance.

Should You Worry?

Before ADO.NET.

How ADO.NET Can Help.

Are DataReaders Scalable.

ADO.NET Performance.

Best Practices.

Appendix: ADO Migration Strategies

Planning for Migration to ADO.NET.

ADO.NET Equivalents for ADO Objects.


Index. 0201745682T10112002


ADO.NET is not ADO. This is the most important fact that this book tries to convey. Understanding ADO.NET is not just about how to get database data or how to update the database. It requires an understanding of why it was built. ADO.NET takes a completely different approach in accessing databases than older Microsoft data access strategies. This is not your fatherUs ADO.

This book intends to be neither a reference nor an "Internals" book of how ADO.NET works. It is geared towards helping day-to-day developers get their jobs done. This book intends to give clear advice on how to use ADO.NET.

Intended Audience

This book is squarely aimed at developers who have a basic understanding of .NET and of databases. It is intended to help day to day developers get their job done. It does not assume prior experience with ADO, though it does build somewhat on that knowledge if it exists.

Part I The Basics of ADO.NET

Part one is intended to get you started with the basics.

Chapter 1 Why ADO.NET

Before the book explains how to work with ADO.NET, it explains why ADO.NET was written. Chapter one discusses the history of Microsoft Data Access to explain how we got to ADO.NET.

Chapter 2 Getting Connected with ADO.NET

Before we can do anything with a database, we must know how to connect to them. Chapter two is all about getting connected to databases through ADO.NET. This includes a discussion of how connection strings work, connection pooling in a variety of Managed Providers, patterns for connection creation and how to minimize connections to the database.

Chapter 3 Commanding the Database

Our only interface with the database is to issue commands and deal with the result of those commands. This chapter focuses on how to get the database to do work for us by using Command objects. This includes explanation of how to use the Command objects with simple SQL statements, parameterized queries, stored procedures and batch queries.

Chapter 4 Reading Data

DataReaders are ADO.NETUs method for getting tables from the database. In chapter four, the book explains how to use DataReaders to access database information and shows an example of writing a class that uses the DataReader as its data source.

Part II All about DataSets

The DataSet is the heart of ADO.NET. To use the DataSet effectively, we must examine how it can be used to solve our day-to-day problems.

Chapter 5 Constructing DataSets

This chapter explains exactly what DataSets are and why you should use them. It covers the many ways to make DataSets including using DataAdapters, XML and code to create them. A complete discussion of how to use DataSet schema is also included in this chapter.

Chapter 6 Typed DataSets

Typed DataSets are a useful tool to allow you to have code that adapts to changing schema. Chapter six explores this new programming model where we create Typed DataSets and use them as the basis for business logic layers that are typically all hand-written. This chapter also shows how to create Typed DataSets from within Visual Studio.NET as well as from the command-line.

Chapter 7 Working with DataSets

Now that we know how to create our DataSets, we need to understand how to use them to manipulate data and how the data is structured inside them. Chapter seven explains how the DataSet model works and how you can use it to get your job done.

Chapter 8 Updating the Database

Once we have manipulated data within a DataSet, we have to have a way to update the database with those changes. Chapter eight walks you through how to plan for disconnected concurrency. It includes examples of using the built-in optimistic concurrency and how to implement pessimistic and destructive concurrency. In addition, the chapter discusses how to handle concurrency violations and gives concrete examples of one solution for dealing with concurrency violations.

Part III ADO.NET in Action

Now that we know how to access data, manipulate it and update the database with the changes, we need to know how we can get ADO.NET to interact with the rest of the .NET framework.

Chapter 9 ADO.NET and XML

XML is just data. ADO.NET is the data framework for .NET. These two facts come together to show why ADO.NET is so tightly integrated with the XML framework to allow for database data to be commingled with database data. Chapter nine explores the way to treat each type of data like their brethren.

Chapter 10 Data Binding with ADO.NET

In .NET, there are two forms based technologies Windows Forms and Web Forms. Luckily, ADO.NET containers (DataReaders, DataSet, and DataTables) all support direct data binding. Chapter ten shows you how.

Chapter 11 Scalability & Performance

This chapter brings it all together with concrete design suggestions for how to build scalable, high performance systems. In addition, the chapter lists a set of best practices for using ADO.NET and database development in general.

Appendix Migration Strategies for ADO to ADO.NET

We cannot pretend that all .NET code will be all new development. There are many developers out there who have code to migrate to .NET. This appendix lists a number of strategies for living in a mixed system where you need to have ADO.NET data structures reading ADO structures and vice versa.



I first met Shawn via email a number of years ago. He hung out at the same mailing lists that I did and had interesting things to say, so, when I needed some help on a project, he was on my list of potentials. I remember sending out an email late one evening, expecting a response sometime the next day. Forty-five minutes later as I was checking email one last time before going to bed, I already had a response from Shawn, who was three time zones later than I was. Not only was he willing, he was enthusiastic about the project and brimming with experience and ideas. That was the beginning of a relationship that brought us together daily for the next three years, and it's been fruitful for me ever since.

During the tail end of our project together, Shawn got another request for help on a project, this time from the Microsoft database community as a whole. The request was to fill a much-needed gap in the knowledge of Microsoft's latest database technology: ADO.NET. And once again, not only was Shawn willing, he was enthusiastic, setting up his own ADO.NET forum on the Web and jumping into DevelopMentor's new .NET mailing list, answering most of the deluge of database questions off the top of his head. The growing base of knowledge that Shawn was gathering about the importance of ADO.NET in a fully networked world, and the corresponding details that you need to make it actually work, eventually caused him to ask me whether he should write a book. I told him that if he could think of anything else to do in his free time, he should do that instead. Writing a good book (which I knew was what he was after) is too hard. The only way to make it through is if you've got a burning story in your heart that you can't not tell.

Thankfully for the rest of us, Shawn's story has burned its way onto the pages of the book you now hold in your hand. Whether Shawn has already helped you with your database problems online or whether this is your first exposure to his work, I'm quite confident that it will be, like mine, a very fruitful relationship indeed.

Chris Sells


Click below to download the Index file related to this title:


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020