Book description
Get a practical introduction to the Microsoft .NET Framework 2.0 libraries (ADO.NET 2.0) that communicate, access, sort, and interact with data from .NET-connected applications. Includes coverage of XML data and Microsoft SQL Server 2005.
Table of contents
- Programming Microsoft® ADO.NET 2.0 Core Reference
- A Note Regarding Supplemental Files
- Acknowledgments
- Introduction
-
I. Getting Started with Microsoft ADO.NET 2.0
- 1. Overview of ADO.NET
-
2. Building Your First ADO.NET Application with Microsoft Visual Studio 2005
- Everyone Loves a Demo
-
Creating Your Data Access Form Without Code
- Create the New Project
- Add a New Data Source
- Using the Data Source to Add Items to the Form
- Running the Project
- Adding Related Data to the Form
- Examining the Code Generated by Visual Studio
- You Can Write Better Data-Access Code Than the Designers!
- Questions That Should Be Asked More Frequently
-
II. Getting Connected: Using a .NET Data Provider
-
3. Connecting to Your Database
- Creating SqlConnection Objects
- Opening SqlConnection Objects
- Closing SqlConnection Objects
- Cleaning Up After Yourself
-
Connection Strings
- What Is a Connection String?
-
Introducing Connection String Builders
- Using a Connection String Builder
- Connection Strings, Meet IntelliSense; IntelliSense, Meet Connection Strings
- Handling Complex Connection String Option Values
- Malicious Connection String Input, Also Known as Connection String Injection
- Preventing Connection String Injection with Connection String Builders
- Recognizing Keyword Aliases
- Creating a Connection-String Dialog Box with a Connection-String Builder
- Connection String Security
-
Connection Pooling
- Connection Handles and Physical Connections
- What Is Connection Pooling?
- How Connection Pooling Can Improve Your Code
- Enabling Connection Pooling
- When Will My Pooled Connection Be Closed?
- Disabling Connection Pooling
- Answering Your Own Questions About Connection Pooling
- How ADO.NET Determines Whether to Use a Pooled Connection
- Forcing ADO.NET to Use a New Pool
- Manually Releasing Pooled Connections
- What Other Pooling Options Do I Have?
- Using the SqlConnection as a Starting Point
- Visual Studio Design-Time Features
- SqlConnection Object Reference
- Questions That Should Be Asked More Frequently
-
4. Querying Your Database
-
Using SqlCommand Objects in Code
- Creating a SqlCommand Object
- Using a SqlCommand to Execute Queries
- Executing a Row-Returning Query
- Retrieving a Single Value
- Executing a Query That Does Not Return a Resultset
- Executing Batches of Action Queries
- Executing a Query to Retrieve XML Data
- Executing a Query in a Transaction
- Executing a Query Asynchronously
-
Working with the SqlDataReader
- Examining the Results of Your Query
- Closing Your SqlDataReader
-
Examining the Schema of Your Resultset
- Determining the Number of Available Fields
- Determining the Number of Rows Returned
- Determining the Name of the Field
- Determining the .NET Data Type for a Field
- Determining the Database Data Type for a Field
- Determining the Ordinal for a Field
- Additional Resultset Schema Information
- Using CommandBehavior
- Fetching Data Faster with Ordinal-Based Lookups
- Strongly Typed Getters
- Handling Null Values
- SqlTypes
- Handling Multiple Resultsets from a Query
- SQL Server 2005 and Multiple Active Resultsets
- Working with Parameterized Queries
- Microsoft Visual Studio Design-Time Features
-
Object Reference for SqlCommand, SqlDataReader, and SqlParameter
- Properties of the SqlCommand Class
-
Methods of the SqlCommand Class
- BeginExecuteReader, BeginExecuteNonQuery, and BeginExecuteXmlReader Methods
- Cancel Method
- Clone Method
- CreateParameter Method
- EndExecuteReader, EndExecuteNonQuery, and EndExecuteXml Reader Methods
- ExecuteNonQuery Method
- ExecuteReader Method
- ResetCommandTimeout Method
- ExecuteScalar Method
- Prepare Method
- Event of the SqlCommand Class
- Properties of the SqlDataReader Class
-
Methods of the SqlDataReader Class
- Read Method
- GetValue, GetSqlValue, and GetProviderSpecificValue Methods
- Get<DataType> Methods
- GetValues, GetSqlValues, and GetProviderSpecificValues Methods
- NextResult Method
- Close Method
- GetName, GetOrdinal, and GetDataTypeName Methods
- GetFieldType and GetProviderSpecificFieldType Methods
- GetSchemaTable Method
- GetData Method (and Depth Property)
- Creating SqlParameter Objects
- Properties of the SqlParameter Class
- Questions That Should Be Asked More Frequently
-
Using SqlCommand Objects in Code
-
5. Retrieving Data Using SqlDataAdapter Objects
- What Is a SqlDataAdapter Object?
- Creating and Using SqlDataAdapter Objects
- Visual Studio 2005 Design-Time Features
-
SqlDataAdapter Reference
-
Properties of the SqlDataAdapter Class
- SelectCommand, UpdateCommand, InsertCommand, and DeleteCommand
- TableMappings Property
- MissingMappingAction and MissingSchemaAction Properties
- AcceptChangesDuringFill and AcceptChangesDuringUpdate Properties
- ContinueUpdateOnError Property
- ReturnProviderSpecificTypes Property
- FillLoadOption Property
- UpdateBatchSize Property
- Methods of the SqlDataAdapter Class
- Events of the SqlDataAdapter Class
-
Properties of the SqlDataAdapter Class
- Questions That Should Be Asked More Frequently
-
3. Connecting to Your Database
-
III. Working with Data Offline—The ADO.NET DataSet
-
6. Working with DataSet Objects
- Features of the DataSet Class
-
Using DataSet Objects
- Creating a DataSet Object
- Examining the Structure Created by Calling SqlDataAdapter.Fill
- Examining the Data Returned by a SqlDataAdapter
- Validating Data in Your DataSet
- Creating DataTable Objects in Code
- Autoincrement Do’s and Don’ts
- Modifying the Contents of a DataTable
- ADO.NET 2.0 DataSet Serialization and Remoting Options
- Working with DataSet Objects in Visual Studio
-
DataSet, DataTable, DataColumn, DataRow, UniqueConstraint, and ForeignKeyConstraint Class Reference
-
Properties of the DataSet Class
- CaseSensitive Property
- DataSetName Property
- DefaultViewManager Property
- DesignMode Property
- EnforceConstraints Property
- ExtendedProperties Property
- HasErrors Property
- IsInitialized Property
- Locale Property
- Namespace and Prefix Properties
- Relations Property
- RemotingFormat Property
- SchemaSerializationMode Property
- Tables Property
- Methods of the DataSet Class
- DataSet, DataTables, and the ISupportInitializeNotification Interface
- Events of the DataSet Class
-
Properties of the DataTable Class
- CaseSensitive Property
- ChildRelations and ParentRelations Properties
- Columns Property
- Constraints Property
- DataSet Property
- DefaultView Property
- DesignMode Property
- ExtendedProperties Property
- HasErrors Property
- IsInitialized Property
- Locale Property
- MinimumCapacity Property
- Namespace and Prefix Properties
- PrimaryKey Property
- RemotingFormat Property
- Rows Property
- TableName Property
-
Methods of the DataTable Class
- AcceptChanges and RejectChanges Methods
- BeginInit and EndInit Methods
- BeginLoadData and EndLoadData Methods
- Clear Method
- Clone and Copy Methods
- Compute Method
- CreateDataReader Method
- GetChanges Method
- GetErrors Method
- ImportRow, LoadDataRow, and NewRow Methods
- Load Method
- ReadXml, ReadXmlSchema, WriteXml, and WriteXmlSchema Methods
- Reset Method
- Select Method
- Events of the DataTable Class
-
Properties of the DataColumn Class
- AllowDBNull Property
- AutoIncrement, AutoIncrementSeed, and AutoIncrementStep Properties
- Caption Property
- ColumnMapping Property
- ColumnName Property
- DataType Property
- DateTimeMode Property
- DefaultValue Property
- Expression Property
- ExtendedProperties Property
- MaxLength Property
- Namespace and Prefix Properties
- Ordinal Property
- ReadOnly Property
- Table Property
- Unique Property
- Properties of the DataRow Class
-
Methods of the DataRow Class
- AcceptChanges and RejectChanges Methods
- BeginEdit, CancelEdit, and EndEdit Methods
- ClearErrors Method
- Delete Method
- GetChildRows Method
- GetColumnError and SetColumnError Methods
- GetColumnsInError Method
- GetParentRow, GetParentRows, and SetParentRow Methods
- HasVersion Method
- IsNull Method
- SetAdded and SetModified Methods
- Properties of the UniqueConstraint Class
- Properties of the ForeignKeyConstraint Class
-
Properties of the DataSet Class
- Questions That Should Be Asked More Frequently
-
7. Working with Relational Data
- A Brief Overview of Relational Data Access
- Working with DataRelation Objects in Code
- Creating DataRelation Objects in Microsoft Visual Studio
- DataRelation Object Reference
- Questions That Should Be Asked More Frequently
-
8. Sorting, Searching, and Filtering
- Using the DataTable Class’s Searching and Filtering Features
- What Is a DataView Object?
- Working with DataView Objects in Code
- Creating DataView Objects in Microsoft Visual Studio
-
DataView Object Reference
- AllowDelete, AllowEdit, and AllowNew Properties
- ApplyDefaultSort Property
- Count and Item Properties
- DataViewManager Property
- IsInitialized Property
- RowFilter Property
- RowStateFilter Property
- Sort Property
- Table Property
- Methods of the DataView Class
- Events of the DataView Class
- Properties of the DataRowView Class
- Methods of the DataRowView Class
- Questions That Should Be Asked More Frequently
-
9. Working with Strongly Typed DataSet Objects and TableAdapters
- Strongly Typed DataSets
- Creating Strongly Typed DataSet Objects
- Using Strongly Typed DataSet Objects
- When to Use Strongly Typed DataSet Objects
- Introducing TableAdapters
- Choosing Your Path
- Questions That Should Be Asked More Frequently
-
10. Submitting Updates to Your Database
- Submitting Updates Using Parameterized SqlCommands
-
Submitting Updates Using a SqlDataAdapter
- Create a procedure (or function) that accepts multiple DataRows
- Look for DataRows that contain pending changes
- Access a SqlCommand that contains the updating logic that corresponds to the DataRow’s RowState property
-
Assign values from the DataRow’s columns to the Value property on the corresponding SqlParameters
- SqlParameter.SourceColumn
- SqlParameter.SourceVersion
- SqlParameter.SourceColumnNullMapping
- Execute the SqlCommand
- Check the number of records affected and indicate failure scenarios, possibly by raising an exception
- Call the DataRow’s AcceptChanges method if submitting the pending change in the DataRow succeeded
- Events Before and After Update Attempts
- The Ability to Assign Retrieved Values Back to DataRows
- Batch Updates
- Using SqlDataAdapter Objects to Submit Updates
- Manually Configuring Your SqlDataAdapter Objects
- Using a SqlCommandBuilder to Generate Updating Logic
- Using the Visual Studio TableAdapter Configuration Wizard to Generate Updating Logic
- Return of the DataAdapters!
- Submitting Updates in SqlTransactions
- SqlCommandBuilder Object Reference
- Questions That Should Be Asked More Frequently
-
11. Advanced Updating Scenarios
- Refreshing a Row After Submitting an Update
- Retrieving Newly Generated Auto-Increment Values
- Submitting Hierarchical Changes
- Isolating and Reintegrating Changes
- Handling Failed Update Attempts
- Working with Distributed Transactions
- Batch Queries
- SQL Bulk Copy
- DataSet Objects and Transactions
- When Handling Advanced Updating Scenarios, Use ADO.NET
- Questions That Should Be Asked More Frequently
-
12. Working with XML Data
- Bridging the Gap Between XML and Data Access
- Reading and Writing XML Data
- DataSet + XmlDocument = XmlDataDocument
- Using SQL Server 2005’s XML Features
- Retrieving XML Data from SQL Server 2000 via SELECT...FOR XML
- The SQL XML .NET Data Provider
- A Simple ADO.NET and XML Sample
- Questions That Should Be Asked More Frequently
-
6. Working with DataSet Objects
-
IV. Building Effective Applications with ADO.NET 2.0
-
13. Building Effective Microsoft Windows—Based Applications
-
Building a User Interface Quickly by Using Data Binding
- Step 1: Creating Your Strongly Typed DataSet
- Step 2: Adding Simple Bound Controls to the Form
- Step 3: Retrieving Data
- Step 4: Navigating Through the Results
- Step 5: Adding and Deleting Items
- Step 6: Submitting Changes
- Step 7: Adding Edit, Accept, and Reject Buttons
- Step 8: Viewing Child Data
- Step 9: Binding a Second Form to the Same Data Source
- Step 10: Improving the User Interface
- Step 11: If You Want Something Done (Just) Right...
- Data Binding Summary
- Application Design Considerations
- Questions That Should Be Asked More Frequently
-
Building a User Interface Quickly by Using Data Binding
-
14. Building Effective Web Applications
- Brief Introduction to Web Applications
- Connecting to Your Database
- Challenges Interacting with Databases in ASP.NET 1.0
- Introducing Data Source Controls
- Caching Data Between Roundtrips
-
Paging
- Paging Features of the GridView Control
- Paging Features of the DataAdapter Classes
- Building Queries That Return a Page of Data
- Questions That Should Be Asked More Frequently
-
15. SQL Server 2005 Common Language Runtime Integration
- Extending SQL Server the Old Way—Extended Stored Procedures
- Extending SQL Server the New Way—CLR Integration
- Using Microsoft Visual Studio 2005 to Simplify Building SQL CLR Code
- SQL CLR Scenarios
- Creating a SQL CLR User-Defined Type
- Summary
- Questions That Should Be Asked More Frequently
-
13. Building Effective Microsoft Windows—Based Applications
-
V. Appendixes
-
A. Using Other .NET Data Providers
- The Provider Factory Model
- The ODBC .NET Data Provider
- The OLE DB .NET Data Provider
- The Oracle Client .NET Data Provider
- B. Samples and Tools
- C. About the Author
-
A. Using Other .NET Data Providers
- Index
- About the Author
- Copyright
Product information
- Title: Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition
- Author(s):
- Release date: August 2006
- Publisher(s): Microsoft Press
- ISBN: 9780735622067
You might also like
book
Programming Microsoft® ADO.NET 2.0 Applications: Advanced Topics
Get in-depth coverage and expert insights on advanced ADO.NET programming topics such as optimization, DataView, and …
book
Programming Microsoft® ASP.NET 4
Completely reengineered for ASP.NET 4—this definitive guide deftly illuminates the core architecture and programming features of …
book
Programming in C#: Exam 70-483 (MCSD) Guide
Acquire necessary skills in preparing for Microsoft certification and enhance your software development career by learning …
book
Programming Microsoft® ASP.NET 3.5
Get the practical, popular reference written by ASP.NET authority Dino Esposito now updated for ASP.NET 3.5. …