Microsoft® ADO.NET 4 Step by Step

Book description

Teach yourself the fundamentals of ADO.NET 4 -- one step at a time. With this practical, learn-by-doing tutorial, you get the clear guidance and hands-on examples you need to start creating datacentric applications for Windows and the Web.

Discover how to:

  • Connect to external data sources, including databases and other data formats

  • Use ADO.NET Entity Framework to interact with underlying data stores

  • Build Entity Framework models with graphical design tools in Microsoft Visual Studio 2010

  • Analyze information stored in ADO.NET with various LINQ providers

  • Bind data directly to Windows Forms and Web Forms to drive information to users

  • Manage disconnected or standalone data and information

  • Go beyond the core functionality of ADO.NET to manipulate data in more advanced ways

Your step by step digital content includes:

  • Practice exercises

  • Fully searchable online edition of this book -- with unlimited access on the Web

https://www.microsoftpressstore.com/content/images/9780735638884/downloads/9780735638884_files.zip

Table of contents

  1. Microsoft® ADO.NET 4 Step by Step
  2. Table of Contents
  3. Dedication
  4. Acknowledgments
  5. Introduction
    1. Who Is This Book For?
      1. Assumptions
        1. Assumptions
    2. Organization of This Book
      1. Finding Your Best Starting Point in This Book
    3. Conventions and Features in This Book
    4. System Requirements
    5. Code Samples
      1. Installing the Code Samples
      2. Installing the Sample Database
      3. Using the Code Samples
      4. Uninstalling the Code Samples
      5. Software Release
    6. Errata and Book Support
    7. We Want to Hear from You
    8. Stay in Touch
  6. I. Getting to Know ADO.NET
    1. 1. Introducing ADO.NET 4
      1. What Is ADO.NET?
      2. Why ADO.NET?
      3. Major Components of ADO.NET
      4. Extensions to ADO.NET
      5. Connecting to External Data
        1. Creating a Data Source Using the Connection Wizard
      6. Summary
      7. Chapter 1 Quick Reference
    2. 2. Building Tables of Data
      1. Implementing Tables
        1. Logical and Physical Table Implementations
        2. The DataTable Class
          1. Creating a DataTable: C#
          2. Creating a DataTable: Visual Basic
      2. Adding Data Columns
        1. Adding Columns to a DataTable: C#
          1. Adding Columns to a DataTable: C#
          2. Adding Columns to a DataTable: Visual Basic
      3. Dataset Designer
        1. Creating a Custom Table in the Dataset Designer
          1. Creating a Custom Table in the Dataset Designer
          2. Adding a Database Table to the Dataset Designer
          3. Using Dataset Designer Tables in Code
      4. Summary
      5. Chapter 2 Quick Reference
    3. 3. Storing Data in Memory
      1. Adding Data
        1. Creating New Rows
        2. Defining Row Values
        3. Storing Rows in a Table
          1. Adding Rows to a DataTable: C#
          2. Adding Rows to a DataTable: Visual Basic
      2. Examining and Changing Data
        1. Modifying Existing Rows in a DataTable: C#
          1. Modifying Existing Rows in a DataTable: C#
          2. Modifying Existing Rows in a DataTable: Visual Basic
      3. Removing Data
      4. Batch Processing
        1. Row State
        2. Row Versions
      5. Validating Changes
        1. Exception-Based Errors
        2. Validation-Based Errors
          1. Validating Content in a DataRow: C#
          2. Validating Content in a DataRow: Visual Basic
      6. Summary
      7. Chapter 3 Quick Reference
    4. 4. Accessing the Right Data Values
      1. Querying and Sorting Data
        1. Finding Rows by Primary Key
          1. Finding a Row by Primary Key: C#
          2. Finding a Row by Primary Key: Visual Basic
        2. Selecting Rows with a Search Criteria
        3. Sorting Search Results
          1. Selecting and Sorting DataRow Objects: C#
          2. Selecting and Sorting DataRow Objects: Visual Basic
        4. Performing Case-Sensitive Lookups
      2. Using Expression Columns
        1. Adding Expression Columns to a DataTable: C#
          1. Adding Expression Columns to a DataTable: C#
          2. Adding Expression Columns to a DataTable: Visual Basic
      3. Summary
      4. Chapter 4 Quick Reference
    5. 5. Bringing Related Data Together
      1. Collecting Tables into Sets
        1. Adding Tables to a DataSet: C#
          1. Adding Tables to a DataSet: C#
          2. Adding Tables to a DataSet: Visual Basic
      2. Establishing Relationships Between Tables
        1. Understanding Table Relations
        2. Creating Data Relations
          1. Adding a Relationship Between Two Tables: C#
          2. Adding a Relationship Between Two Tables: Visual Basic
        3. Locating Parent and Child Records
      3. Defining Table Constraints
        1. Defining the Update and Delete Rules in a DataRelation: C#
          1. Defining the Update and Delete Rules in a DataRelation: C#
          2. Defining the Update and Delete Rules in a DataRelation: Visual Basic
      4. Summary
      5. Chapter 5 Quick Reference
    6. 6. Turning Data into Information
      1. Aggregating Data
        1. Generating a Single Aggregate
          1. Computing an Aggregate Value: C#
          2. Computing an Aggregate Value: Visual Basic
        2. Adding an Aggregate Column
        3. Aggregating Data Across Related Tables
        4. Referencing Parent Fields in Expressions
      2. Setting Up Indexed Views
        1. Creating a DataView
        2. Using a DataView
          1. Generating a New DataTable from a DataView: C#
          2. Generating a New DataTable from a DataView: Visual Basic
      3. Summary
      4. Chapter 6 Quick Reference
    7. 7. Saving and Restoring Data
      1. Serializing DataSet and DataTable Objects
        1. Writing XML
        2. Reading XML
      2. Guiding XML Generation
        1. Identifying Namespaces
        2. Nesting Child Tables
        3. Managing and Positioning Columns
          1. Generating XML from a DataSet: C#
          2. Generating XML from a DataSet: Visual Basic
      3. Summary
      4. Chapter 7 Quick Reference
  7. II. Connecting to External Data Sources
    1. 8. Establishing External Connections
      1. Using Connection Strings
        1. SQL Server Connection Strings
        2. OLE DB and ODBC Connection Strings
        3. Connection String Builders
        4. Storing Connection Strings
      2. Understanding Data Providers
      3. Connecting to SQL Server via a Data Provider
        1. Creating and Opening Connections
          1. Opening a Database Connection: C#
          2. Opening a Database Connection: Visual Basic
        2. Connection Pooling
      4. Summary
      5. Chapter 8 Quick Reference
    2. 9. Querying Databases
      1. Processing SQL Queries
        1. Creating Command Objects
        2. Processing Queries
        3. Processing Asynchronously
      2. Returning Query Results
        1. Returning a Single Value
        2. Returning Data Rows
        3. Accessing Field Values
        4. Processing More Complicated Results
          1. Processing Database Queries: C#
          2. Processing Database Queries: Visual Basic
      3. Summary
      4. Chapter 9 Quick Reference
    3. 10. Adding Standards to Queries
      1. Developing Parameterized Queries
        1. Understanding the Need for Parameters
        2. Implementing Standard Queries
          1. Updating Data with Parameters: C#
          2. Updating Data with Parameters: Visual Basic
        3. Using Parameters with Other Providers
      2. Using Parameters in Stored Procedures
        1. Calling a Stored Procedure with Parameters: C#
          1. Calling a Stored Procedure with Parameters: C#
          2. Calling a Stored Procedure with Parameters: Visual Basic
      3. Summary
      4. Chapter 10 Quick Reference
    4. 11. Making External Data Available Locally
      1. Understanding Data Adapters
      2. Moving Data from Source to Memory
        1. Moving Data into a DataTable
        2. Moving Data into a DataSet
      3. Moving Data from Memory to Source
        1. Configuring the Update Commands
        2. Performing the Update
        3. Generating Update Commands Automatically
          1. Syncing Data with a SqlDataAdapter: C#
          2. Syncing Data with a SqlDataAdapter: Visual Basic
      4. Table and Column Mapping
      5. Summary
      6. Chapter 11 Quick Reference
    5. 12. Guaranteeing Data Integrity
      1. Transactions and Concurrency
      2. Using Local Transactions
        1. Processing with a Local Transaction: C#
          1. Processing with a Local Transaction: C#
          2. Processing with a Local Transaction: Visual Basic
        2. Employing Savepoints
      3. Using Distributed Transactions
        1. Processing with a Distributed Transaction: C#
          1. Processing with a Distributed Transaction: C#
          2. Processing with a Distributed Transaction: Visual Basic
      4. Summary
      5. Chapter 12 Quick Reference
  8. III. Entity Framework
    1. 13. Introducing the Entity Framework
      1. Understanding the Entity Framework
        1. Defining the Entity Framework’s Terms
      2. Understanding the Entity Framework’s Layers
        1. Understanding the Conceptual Model
        2. Understanding the Storage Model
        3. Understanding the Model Mappings
      3. Using the Entity Framework
        1. Building the Model
        2. Generating the Objects
        3. Instantiating the Context
        4. Running Framework Queries
      4. Summary
      5. Chapter 13 Quick Reference
    2. 14. Visualizing Data Models
      1. Designing an Entity Framework Model
        1. Using the Entity Data Model Wizard
          1. Importing Database Tables as Entities
        2. Entity Data Model Designer
          1. Creating a Complex Property from Scalar Properties
        3. Working with the Mapping Details Panel
          1. Adding a Mapping Condition to an Entity
          2. Use a Stored Procedure to Manage Entity Data
        4. Using the Model Browser
      2. Managing the Object Layer
      3. Summary
      4. Chapter 14 Quick Reference
    3. 15. Querying Data in the Framework
      1. Getting to Know Entity SQL
        1. Writing Basic Queries
        2. Using Literals, Operators, and Expressions
        3. Grouping and Aggregating Entity Data
        4. Using Features Unique to Entity SQL
      2. Running Entity SQL Queries
        1. Running Queries Using an ObjectQuery
          1. Retrieving Entity Data Through an ObjectQuery: C#
          2. Retrieving Entity Data Through an ObjectQuery: Visual Basic
        2. Running Queries Using a Provider
          1. Retrieving Entity Data Through a Provider: C#
          2. Retrieving Entity Data Through a Provider: Visual Basic
      3. Summary
      4. Chapter 15 Quick Reference
    4. 16. Understanding Entities Through Objects
      1. Managing Entity Data Through Objects
        1. Accessing Entity Data Through Objects
        2. Modifying Entity Data Through Objects
          1. Modifying a Database Through Entity Objects: C#
          2. Modifying a Database Through Entity Objects: Visual Basic
      2. Using Query Builder Methods
        1. Queryable Extension Methods
          1. Using Query Builder Methods: C#
          2. Using Query Builder Methods: Visual Basic
      3. Summary
      4. Chapter 16 Quick Reference
  9. IV. LINQ
    1. 17. Introducing LINQ
      1. Getting to Know LINQ
      2. Using LINQ with .NET Objects
        1. Starting a Query with the From Clause
        2. Projecting Results with the Select Clause
        3. Filtering Results with the Where Clause
        4. Sorting Results with the Order By Clause
        5. Selecting Linked Results with the Join Keyword
        6. Limiting the Queried Content
        7. Summarizing Data Using Aggregates
        8. Applying Set Operations
      3. Summary
      4. Chapter 17 Quick Reference
    2. 18. Using LINQ to DataSet
      1. Understanding the LINQ to DataSet Provider
      2. Writing Queries with LINQ to DataSet
        1. Querying with LINQ to DataSet: C#
        2. Querying with LINQ to DataSet: Visual Basic
      3. Summary
      4. Chapter 18 Quick Reference
    3. 19. Using LINQ to Entities
      1. Understanding the LINQ to Entities Provider
      2. Writing Queries with LINQ to Entities
        1. Querying with LINQ to Entities: C#
          1. Querying with LINQ to Entities: C#
          2. Querying with LINQ to Entities: Visual Basic
        2. Working with Entity and Database Functions
        3. Working with Custom Database Functions
          1. Calling Custom Database Functions: C#
          2. Calling Custom Database Functions: Visual Basic
      3. Summary
      4. Chapter 19 Quick Reference
    4. 20. Using LINQ to SQL
      1. Understanding the LINQ to SQL Provider
        1. Comparing LINQ to SQL with LINQ to Entities
        2. Understanding the Components of LINQ to SQL
      2. Using the Object Relational Designer
        1. Building a LINQ to SQL Model
          1. Building a LINQ to SQL Model
      3. Using Custom Database Functions in Queries
        1. Querying with LINQ to SQL: C#
          1. Querying with LINQ to SQL: C#
          2. Querying with LINQ to SQL: Visual Basic
      4. Summary
      5. Chapter 20 Quick Reference
  10. V. Presenting Data to the World
    1. 21. Binding Data with ADO.NET
      1. Binding Data in Windows Forms
        1. Creating Complex-Bound Applications
          1. Creating a Complex Data-Bound Form
        2. Creating Simple-Bound Applications
          1. Creating a Simple Data-Bound Form
        3. Understanding Windows Forms Data Binding
      2. Binding Data in WPF
        1. Creating Data-Bound WPF Applications
          1. Creating a Data-Bound WPF Project
          2. Adding Navigation to a Data-Bound WPF Window: C#
          3. Adding Navigation to a Data-Bound WPF Window: Visual Basic
        2. Understanding WPF Data Binding
      3. Binding Data in ASP.NET
        1. Creating Data-Bound ASP.NET Applications
          1. Creating a Data-Bound ASP.NET Page
        2. Understanding ASP.NET Data Binding
      4. Summary
      5. Chapter 21 Quick Reference
    2. 22. Providing RESTful Services with WCF Data Services
      1. Getting to Know the Service Layers
        1. Introducing WCF Data Services
        2. Introducing REST
      2. Setting Up a Data Service
        1. Creating a Data Service from an EF Model: C#
          1. Creating a Data Service from an EF Model: C#
          2. Creating a Data Service from an EF Model: Visual Basic
        2. Defining Service Rights
      3. Accessing a Data Service using REST
        1. Querying Entities with REST
        2. Updating Entities with REST
      4. Summary
      5. Chapter 22 Quick Reference
  11. Index
  12. About the Author
  13. Copyright

Product information

  • Title: Microsoft® ADO.NET 4 Step by Step
  • Author(s): Tim Patrick
  • Release date: October 2010
  • Publisher(s): Microsoft Press
  • ISBN: 9780735656260