ADO. NET is the technology of choice for working with information in databases in .NET applications. In this concise book we will provide you with the essential information you will need to quickly understand and start using ADO. NET in your applications.
What you need to know
This book is for programmers who want to learn how to use ADO.NET in .NET applications. However, this book isn't for beginners and it's assumed that you have:
Some knowledge of C# - we don't use any particularly advanced features, of C# in this book, but you'll need to be comfortable with the basic syntax
Experience using Visual Studio .NET and the command line C# compiler
What this book will teach you
This book covers those features of ADO.NET that you'll find yourself using time and again in your applications.
How ADO. NET fits into the .NET platform and how it differs from previous versions of ADO
How we can store and manipulate data using DataSets
The close relationship between ADO.NET and XML
How we can gain quick, read-only, forward-only access using DataReaders
How we can connect to a wide range of data sources using DataAdapters
When and where you should use ADO.NET in your applications
How Web Services can be used to transfer data in a distributed environment
Introduction
What Does This Book Cover?
Who Is This Book For?
What You Need to Use This Book
Style Conventions
Customer Support and Feedback
Source Code and Updates
Errata
Technical Support
p2p.wrox.com
Chapter 1: What is ADO.NET?
Where ADO.NET Fits into ,NET
Anatomy of ADO,NET
The .NET Data Provider
Connection
Command
DataAdapter
DataReader
Available Data Providers
Creating Your Own .NET Data Provider
The DataSet
Tables
Columns
Rows
Relations
The Typed DataSet
The DataReader
The DataAdapter
Making it Work
ADO vs. ADO.NET
Data Type Comparison
Connections
Recordsets
Forward-Only Data
Stored Procedures
Using ADO in .NET
Summary
Chapter 2: The DataSet
The Anatomy of a DataSet
The DataSet
The DataTable
The DataColumn
The DataRow
Manual Data Example
Relational Data Model Support
Constraints and Keys
Unique Constraint
Foreign Key Constraint
Primary Key
Relations
Communicating with the DataSet
The DataAdapter
Loading from Disk
Manual Population
Merging DataSets
Putting It All Together
Summary
Chapter 3: Strongly Typed DataSets
What is a Typed DataSet?
DataSet Schemas (XSD)
Building Schemas
element
simpleType
complexType
Inferring Schemas
Inference Rules
Inferring Tables
Inferring Columns
Limitations of rnference
Inference Sample
Building Typed DataSets
using Visual Studio .NET
Using the XSD Tool
Hello, Typed DataSet
Relational Data Model Support
Typed DataSet Annotation
codegen
typedName
typedPlural
typedParent
typedChildren
nullValue
The msdata Namespace
ConstraintName
ConstraintOnly
UpdateRule
DeleteRule
AcceptRejectRule
PrimaryKey
Relationship
Putting It All Together
Summary
Chapter 4: XML and ADO.NET
DOM in .NET
XmlDocument
XmlDataDocument
Using the XMLDataDocument for XML Data
XPath
XPathNavigator
Relational View
Bridging the Gap
Advanced Techniques
Limiting a Relational View of an XML Document
Limiting a Relational View of XML with a Typed DataSet
Summary
Chapter 5: DataReaders
Connecting to the Database
Connections to SQL Server
The SqlConnection Class
SQL Server Connection Strings
Don't Forget to Close Connections
Connections to OLE DB Data Sources
Connections to ODBC Data Sources
Executing Commands
The SqlCommand Class
The ExecuteScalar Method
The ExecuteXmIReader Method
Data Readers
The DataReader Classes
Creating a DataReader Object
Specifying Data Reader Characteristics with Command Behavior
Traversing the Records in a Data Reader
Accessing Field Values
Retrieving Data -A Simple Example
Retrieving Data with Parameterized Queries
specifying Parameters in SQL Server .NET Data Provider
Specifying Parameters in OLE DB and ODBC .NET Data Providers
Retrieving Data with Stored Procedures
Advanced Data Retrieval
Retrieving Data Using Output Parameters
Retrieving Multiple Unrelated Result Sets
Retrieving Related Result Sets
Retrieving Hierarchical Result Sets
Retrieving Binary Data
Retrieving Schema Information
Summary
Chapter 6: DataAdapters
DataAdapter Overview
Reading Data
Managing Connections
Managing Implicit Connections
Managing Explicit Connections
Creating Data Adapters Using Commands
Using Commands with Parameters
Using Commands with Stored Procedures
Reading Multiple Tables
Reading Using a SQL JOIN Query
Reading Using Multiple SQL SELECT Statements
Naming and Mapping Tables
Reading Using Multiple Select Commands
Reading Using Multiple Data Adapters
Defining Primary Key
Updating Data
Using Commands to Update Data
Updating Records
Adding Records
Deleting Records
Using Data Adapters to Update Data
Row State and Field Value Versions
Modifying Records in DataSet
RowState and Update Operations
Using a Command Builder
Creating .Update Commands Manually
Updating DataSet with Identity Value
Updating Data Using Transactions
Handling Concurrency Problems
Summary
Chapter 7: ADO.NET in the Enterprise
Where Does ADO.NET Fit?
"Nothin' but ADO.NET"
"A Little Bit of Both"
"No ADO,NET for Me, Thanks"
Comparison
Data Binding
Windows Forms Data Binding
ASP.NET Data Binding
The ServicedComponent
Creating a Standardized Data Access Layer
The Factory Model
ConnectionFactory
CommandFactory
CommandTool
Summary
Chapter 8: Web Services and ADO.NET
Introduction to Web Services
Web Service Standards and Protocols
SOAP
WSDL
UDDI
DISCO
Creating and Using a Web Service
The WebMethod Attribute
Using a Web Service
DataSets and Web Services
Stock Screener Web Service and Application
Creating the Stock Screener Web Service
Updating DataSets via Web Services
Creating the Web Service
Creating the Client Application
Caching Data-Driven .NET Web Services
Output Caching
Data Caching
Web Services Security
ASP.NET and .NET Web Services Security
Authentication
Authorization
Secure Sockets Layer (SSL)
Best Practices for Data-Centric Web Services
Summary
Index
Custom Database Network Connection Libraries
Caching
.NET Changes
Fault Tolerance
.NET Changes
How ASP Development Changes
Web Form Front End
Code-behind Class
Early or Late Bound
Understanding Web Forms
HTML Mark-up
Code-behind Class
Mobile Controls
Summary
Chapter 4: Windows Client Development
Windows Forms: The Big Picture
Windows Forms in Visual Studio .NET
Consuming Controls
Drag, Drop, Generate Code; Repeat as Required
Events
Getting in the (Message) Loop
Rolling Your Own Controls
Understanding Components
Controlling Your Controls
Extended Controls
Composite Controls
Custom Controls
Visual Inheritance
Windows Forms Menus
Data Binding
MDI Applications
Consuming Web Services
The .NET Compact Framework
Summary