Beginning ASP.NET 2.0 and Databases (Paperback)
暫譯: ASP.NET 2.0 與資料庫入門 (平裝本)

John Kauffman, Bradley Millington

  • 出版商: Wrox Press
  • 出版日期: 2006-08-07
  • 售價: $1,600
  • 貴賓價: 9.5$1,520
  • 語言: 英文
  • 頁數: 535
  • 裝訂: Paperback
  • ISBN: 0471781347
  • ISBN-13: 9780471781349
  • 相關分類: .NETASP.NET資料庫
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Description
  • Combining both VB.Net and C# coverage in one book, this guide focuses on using ASP.NET 2.0 for solving business dynamic Web site challenges in a logical progression, from connecting to a database to displaying information to changing data
  • Covers the fundamentals of connecting Web pages to databases, techniques for creating data objects and events, and ways to handle data errors
  • Features tricks and traps for displaying data in grids, lists, and trees
  • Goes beyond the usual basic techniques to discuss the best practices and pitfalls that can occur in real-world scenarios with SQL Server, Oracle, MySQL, Access, and the new SQL Server Express Edition

 

 

Table of Contents

Introduction.

Chapter 1: Introduction to ASP.NET 2.0 and ADO.NET.

Overview of the .NET Technologies.

Introduction to the .NET Framework.

Introduction to ASP.NET.

Introduction to ASP.NET 2.0.

Introduction to ADO.NET.

Review of ASP.NET 1.x and ADO.NET for Data Access.

ASP.NET 2.0 and Data Access.

Review of Terminology.

Requirements for Using ASP.NET 2.0.

A Web Server.

The .NET Framework Version 2.0.

An Editor to Create Web Pages.

A Database Management System.

Setup for This Book.

Install Visual Web Developer Express, SSE, and the ASP.NET Development Server.

Download This Book’s Files.

Create the Practice Web Site.

Install the Sample Databases.

Demonstrations.

Common Mistakes.

Summary.

Exercises.

Chapter 2: Connecting to an Access Database.

Introduction to Microsoft Access and the JET Database Engine.

Pros and Cons of Using Access in Web Applications.

Connecting to a Microsoft Access Database in Visual Web Developer.

Using an AccessDataSource Control.

Variations in Select Statements.

Variations in MDB File Location.

Managing MDB File Permissions.

Handling Access Connection Failures Gracefully.

Common Mistakes.

Summary.

Exercises.

Chapter 3: Connecting to SQL Server and SQL Server Express.

Introduction to SQL Server and Connection Strings.

Preparing to Use a SQL Server Database.

Specifying Connection Strings.

Using the SqlDataSource Control.

Understanding Security in SQL Server.

Authentication Options in SQL Server.

Authentication with SQL Server Express.

Database Rights with SQL Server Express.

Authentication Requirements for the SqlDataSource Control.

Storing the Connection String in the web.config File.

Manually Adding a Connection String to the web.config File.

Encrypting Connection Strings.

Choosing between DataSet and DataReader.

Discovering the Schema of an Unfamiliar Database.

Handling Failures with SqlDataSource.

Common Mistakes.

Summary.

Exercises.

Chapter 4: Connecting to Other Relational Databases.

Introduction to Connections with Providers.

Understanding the Relationship between Layers of Connectivity Software.

Understanding Supported ADO.NET Providers.

Using ADO.NET Providers in ASP.NET 2.0.

Connecting to an Access MDB File When a Password Is Used.

Connecting to Oracle Database.

Connecting to MySQL.

Syntax for an ODBC Connection to MySQL.

Connecting to Excel.

Connecting to Other Databases.

Exploring Common Mistakes.

Summary.

Exercises.

Chapter 5: Displaying Data in Tables.

Displaying Data in ASP.NET 2.0.

Review of Data-Bound and Data Source Controls.

Types of Data-Bound Controls.

Introduction to the GridView Control.

Capabilities of the GridView Control.

GridView Rendering Elements.

Connecting a GridView to Data.

Drag and Drop Fields from Data Explorer.

Drag and Drop Controls from the Toolbox.

Customizing the GridView’s Columns.

Selecting Columns in the Edit Columns Dialog Box.

Types of Column Fields.

Using the AutoGenerateColumns Property of the GridView.

Handling Null Field Values.

The DetailsView Control.

DetailsView Rendering Elements.

Connecting the DetailsView to Data.

Common Mistakes.

Summary.

Exercises.

Chapter 6: Customizing the Appearance of Tables.

Customizing the Appearance of an Entire Table.

Setting the BackColor and a BackImageUrl.

Font and ForeColor.

Height and Width.

CellSpacing and CellPadding.

Borders and GridLines.

HorizontalAlign.

ShowHeader and ShowFooter.

ToolTip.

Customizing Styles within a Table.

GridView and DetailsView Styles.

Empty Tables.

Styles Specific to the DetailsView Control.

Column Styles and Field Styles.

Using Cascading Style Sheets.

Understanding the Precedence of Styles.

Implementing Themes and Skins.

Using Auto Format in VWD.

Solving Common Mistakes.

Summary.

Exercises.

Chapter 7: Sorting and Paging Data.

Introduction.

Sorting.

Requirements to Enable Sorting.

Understanding How ASP.NET 2.0 Manages Sorting.

Sort Expressions.

Paging.

Enabling Paging.

Customizing Paging and Pager Navigation Tools.

Paging Theory and Alternatives.

The Relationship among Sorting, Paging, and Selecting.

Common Mistakes.

Summary.

Exercises.

Chapter 8: Displaying Data in Selection Lists.

Introduction to Selection Lists.

Transition from GridView to Other Formats.

Types of Selection List Controls.

Concepts Common to All Selection List Controls.

Data-Binding List Controls.

DropDownList Control.

Selection in a List.

SelectedIndex and SelectedValue.

Automatic Postback.

Common Mistakes.

Summary.

Exercises.

Chapter 9: Filtering and MasterDetails Scenarios.

Introducing Master–Details Scenarios.

Filtering GridView Records Using a Query String.

Filtering GridView Records Using a TextBox.

Using the SQL LIKE Operator.

The Theory of Selection and ControlParameters.

Scoping GridView Records Using a Selection List Control.

Master Control by DropDownList with Hard-Coded Items.

Master Control by ListBoxes with Data-Bound Items.

Display Options for GridView in Master-Details Scenario.

Master Control by List Boxes with a Default Setting That Shows all Records in the GridView.

Displaying Details Using a GridView and DetailsView on the Same Page.

Displaying Details Using a GridView and DetailsView on Different Pages.

Cascading DropDownLists.

Common Mistakes.

Summary.

Exercises.

Chapter 10: Displaying Data in Templated Controls and Data Binding.

Introduction to Templates.

Template Location and Scope.

Template Contents.

Record Rendering: Repeat and Single.

Subsections of Templates.

Data Binding in Templates.

General Guidelines for Using Templated Controls.

GridView Template Columns.

DataList Control.

DataList Control Internal Layout.

Repeater Control.

Templates in the DetailsView Control.

FormView Control.

Comparison of the Templated Controls.

A Few More Advanced Ideas on Data Binding.

Common Mistakes.

Summary.

Exercises.

Chapter 11: Updating and Deleting Data.

Overview of Modifying.

Command Fields.

Simple Update.

DataKeyNames and Updates.

Update in a DetailsView.

Parameters Collections.

Handle Nulls in Updates.

Delete to Remove Entire Records.

Common Mistakes.

Summary.

Exercises.

Chapter 12: Inserting New Records.

Theory of Creating New Records.

Support for Insert.

What Happens under the Hood?

Database Considerations When Performing an Insert.

Enabling Insert in a Data Source Control.

Basic Insert Using DetailsView.

DetailsView Insert Starting from GridView.

GridView and DetailsView for Insert on Same Page.

GridView on One Page with DetailsView on a Different Page.

Insert Using TemplateFields.

Using the Bind Syntax in InsertItemTemplate.

Data Entry with RadioButtonLists and DropDownLists.

Data Entry with CheckBoxes.

Inserting with FormView.

Trade-Offs between DetailsView and FormView.

Common Mistakes.

Summary.

Exercises.

Chapter 13: Validation.

Overview of Validation Controls.

What Are Validation Controls?

What Scenarios Do Validations Support?

Common Concepts of Validation Controls.

Common Properties.

Implementation of Validation Controls.

How Validation Works behind the Scenes.

Multiple Validations.

Types of Validation controls.

Validation in Data Scenarios.

Validation Summary.

Validation Groups.

Validation in Code.

Common Mistakes.

Summary.

Exercises.

Chapter 14: Business Objects As a Source of Data.

Introduction to the ObjectDataSource Control.

Layers of an N-Tier Application.

Advantages of N-Tier Architectures.

Simple Objects with Hard-Coded Data.

Binds to a Hard-Coded Array.

Objects That Use Generics.

Objects That Bind to a DataSource.

Using VWD to Build Objects with Data.

Object That Returns a DataSet List.

Objects That Modify Data.

Master-Details with a Data Object.

Sorts in a Data Object.

Common Mistakes.

Summary.

Exercises.

Chapter 15: XML and Other Hierarchical Data.

What Is Hierarchical Data?

Types of Hierarchical Data.

ASP.NET 2.0 Hierarchical Data Controls.

XmlDataSource and the TreeView Control.

DataBinding and Formatting the TreeView.

XPath with XmlDataSource.

Handling Events in a TreeView Control.

Hierarchical Data with Other Controls.

XmlDataSource and the DropDownList.

XmlDataSource and GridView.

XmlDataSource and DataList.

XmlDataSource and DataList with Nesting.

SiteMapDataSource, SiteMapPath, and the Menu Control.

Common Mistakes.

Summary.

Exercises.

Chapter 16: Caching Data.

Caching and Its Benefits.

When to Use Caching.

Understanding State.

Understanding State Staleness.

Caching Options in ASP.NET 2.0.

A Note on Data for the Exercises.

Time-Based Cache Expiration.

Caching with Parameters.

Implementing Filtering Capability.

SQL Server Cache Invalidation.

Caching Partial Pages.

Common Mistakes.

Summary.

Exercises.

Chapter 17: Handling Events for Data Controls.

Introduction to Event Handling.

Execution Control When an Event Is Triggered.

Types of Events.

General Techniques for Writing Event Handlers.

Transfer of Values When an Event Is Triggered.

Location of Event Handlers.

Command and Custom Button Events.

Using Events Raised by Command Buttons or Command FIelds.

Using Events Raised by Buttons with Custom Behavior.

List Selection Events and Page Events.

Data Control Binding Events.

General Error Events.

Common Mistakes.

Summary.

Exercises.

Chapter 18: Performance Checklist.

Convert Pages from Earlier Versions to 2.0.

Switch from Access to SQL Server.

Use the DataReader Instead of the DataSet.

Use OLEDB Instead of ODBC.

Set List Items Statically.

Cache Data.

Cache Whole or Partial Pages.

Use SQL Server Cache Invalidation.

Typecast in Code.

Specifically List Columns Instead of using AutoGenerate Columns.

Turn Off ViewState When Possible.

Set Properties Declaratively.

Use Best Practices in Code.

Precompile Your Pages.

Chapter 19: Case Study: FAQ System.

Project Description.

Database Design.

Development of Files.

Summary.

Appendix A: A Short and Practical Introduction to SQL Statements.

Appendix B: Exercise Answers.

Index.

商品描述(中文翻譯)

**描述**

- 本書結合了 VB.Net 和 C# 的內容,專注於使用 ASP.NET 2.0 解決商業動態網站的挑戰,邏輯性地從連接資料庫到顯示資訊再到更改資料。
- 涵蓋了將網頁連接到資料庫的基本概念、創建資料物件和事件的技術,以及處理資料錯誤的方法。
- 提供了在網格、列表和樹狀結構中顯示資料的技巧和陷阱。
- 超越一般的基本技術,討論在 SQL Server、Oracle、MySQL、Access 及新的 SQL Server Express Edition 中可能出現的最佳實踐和陷阱。

**目錄**

- 介紹。
- 第1章:ASP.NET 2.0 和 ADO.NET 介紹。
- .NET 技術概述。
- .NET 框架介紹。
- ASP.NET 介紹。
- ASP.NET 2.0 介紹。
- ADO.NET 介紹。
- ASP.NET 1.x 和 ADO.NET 資料存取回顧。
- ASP.NET 2.0 和資料存取。
- 術語回顧。
- 使用 ASP.NET 2.0 的要求。
- 網頁伺服器。
- .NET 框架版本 2.0。
- 創建網頁的編輯器。
- 資料庫管理系統。
- 本書的設置。
- 安裝 Visual Web Developer Express、SSE 和 ASP.NET 開發伺服器。
- 下載本書的檔案。
- 創建練習網站。
- 安裝範例資料庫。
- 示範。
- 常見錯誤。
- 總結。
- 練習。

- 第2章:連接到 Access 資料庫。
- Microsoft Access 和 JET 資料庫引擎介紹。
- 在網頁應用程式中使用 Access 的優缺點。
- 在 Visual Web Developer 中連接到 Microsoft Access 資料庫。
- 使用 AccessDataSource 控制項。
- 選擇語句的變化。
- MDB 檔案位置的變化。
- 管理 MDB 檔案權限。
- 優雅地處理 Access 連接失敗。
- 常見錯誤。
- 總結。
- 練習。

- 第3章:連接到 SQL Server 和 SQL Server Express。
- SQL Server 和連接字串介紹。
- 準備使用 SQL Server 資料庫。
- 指定連接字串。
- 使用 SqlDataSource 控制項。
- 理解 SQL Server 的安全性。
- SQL Server 的身份驗證選項。
- 使用 SQL Server Express 的身份驗證。
- SQL Server Express 的資料庫權限。
- SqlDataSource 控制項的身份驗證要求。
- 將連接字串儲存在 web.config 檔案中。
- 手動將連接字串添加到 web.config 檔案中。
- 加密連接字串。
- 在 DataSet 和 DataReader 之間選擇。
- 探索不熟悉的資料庫的架構。
- 使用 SqlDataSource 處理失敗。
- 常見錯誤。
- 總結。
- 練習。

- 第4章:連接到其他關聯資料庫。
- 與提供者的連接介紹。
- 理解連接軟體層之間的關係。
- 理解支援的 ADO.NET 提供者。
- 在 ASP.NET 2.0 中使用 ADO.NET 提供者。
- 當使用密碼時連接到 Access MDB 檔案。
- 連接到 Oracle 資料庫。
- 連接到 MySQL。
- 連接到 MySQL 的 ODBC 語法。
- 連接到 Excel。
- 連接到其他資料庫。
- 探索常見錯誤。
- 總結。
- 練習。

- 第5章:在表格中顯示資料。
- 在 ASP.NET 2.0 中顯示資料。
- 資料綁定和資料來源控制項回顧。
- 資料綁定控制項的類型。
- GridView 控制項介紹。
- GridView 控制項的功能。
- GridView 渲染元素。
- 將 GridView 連接到資料。
- 從資料探索器拖放欄位。
- 從工具箱拖放控制項。
- 自訂 GridView 的欄位。
- 在編輯欄位對話框中選擇欄位。
- 欄位類型。
- 使用 GridView 的 AutoGenerateColumns 屬性。
- 處理空欄位值。
- DetailsView 控制項。
- DetailsView 渲染元素。
- 將 DetailsView 連接到資料。
- 常見錯誤。
- 總結。
- 練習。

- 第6章:自訂表格的外觀。
- 自訂整個表格的外觀。
- 設定 BackColor 和 BackImageUrl。
- 字型和 ForeColor。
- 高度和寬度。
- CellSpacing 和 CellPadding。
- 邊框和網格線。
- HorizontalAlign。
- ShowHeader 和 ShowFooter。
- ToolTip。
- 在表格內自訂樣式。
- GridView 和 DetailsView 樣式。
- 空表格。
- 特定於 DetailsView 控制項的樣式。
- 欄位樣式和欄位樣式。
- 使用層疊樣式表。
- 理解樣式的優先順序。
- 實施主題和外觀。
- 在 VWD 中使用自動格式。
- 解決常見錯誤。
- 總結。
- 練習。

- 第7章:排序和分頁資料。
- 介紹。
- 排序。
- 啟用排序的要求。
- 理解 ASP.NET 2.0 如何管理排序。
- 排序表達式。
- 分頁。
- 啟用分頁。
- 自訂分頁和分頁導航工具。
- 分頁理論和替代方案。
- 排序、分頁和選擇之間的關係。
- 常見錯誤。
- 總結。
- 練習。

- 第8章:在選擇列表中顯示資料。
- 選擇列表介紹。
- 從 GridView 轉換到其他格式。
- 選擇列表控制項的類型。
- 所有選擇列表控制項的共同概念。
- 資料綁定列表控制項。
- DropDownList 控制項。
- 在列表中的選擇。
- SelectedIndex 和 SelectedValue。
- 自動回發。
- 常見錯誤。
- 總結。
- 練習。

- 第9章:過濾和主從情境。
- 介紹主從情境。
- 使用查詢字串過濾 GridView 記錄。
- 使用 TextBox 過濾 GridView 記錄。
- 使用 SQL LIKE 運算子。
- 選擇和 ControlParameters 的理論。
- 使用選擇列表控制項範圍 GridView 記錄。
- 使用硬編碼項目的 DropDownList 作為主控制項。
- 使用資料綁定項目的 ListBoxes 作為主控制項。
- 在主從情境中 GridView 的顯示選項。
- 使用預設設置顯示 GridView 中所有記錄的 List Boxes 作為主控制項。
- 使用 GridView 和 DetailsView 在同一頁面上顯示詳細資訊。
- 使用 GridView 和 DetailsView 在不同頁面上顯示詳細資訊。
- 層疊的 DropDownLists。
- 常見錯誤。
- 總結。
- 練習。

- 第10章:在模板控制項和資料綁定中顯示資料。
- 模板介紹。
- 模板位置和範圍。
- 模板內容。
- 記錄渲染:重複和單一。
- 模板的子部分。
- 模板中的資料綁定。
- 使用模板控制項的一般指導方針。
- GridView 模板欄位。
- DataList 控制項。
- DataList 控制項內部佈局。
- Repeater 控制項。
- DetailsView 控制項中的模板。
- FormView 控制項。
- 模板控制項的比較。
- 關於資料綁定的更多進階想法。
- 常見錯誤。
- 總結。
- 練習。

- 第11章:更新和刪除資料。
- 修改概述。
- 命令欄位。
- 簡單更新。
- DataKeyNames 和更新。
- 在 DetailsView 中更新。
- 參數集合。
- 在更新中處理 Null。
- 刪除以移除整個記錄。
- 常見錯誤。
- 總結。
- 練習。

- 第12章:插入新記錄。
- 創建新記錄的理論。
- 支援插入。
- 背後發生了什麼?
- 執行插入時的資料庫考量。
- 在資料來源控制項中啟用插入。
- 使用 DetailsView 的基本插入。
- 從 GridView 開始的 DetailsView 插入。
- 在同一頁面上使用 GridView 和 DetailsView 進行插入。
- 在一頁的 GridView 和不同頁面的 DetailsView。
- 使用 TemplateFields 進行插入。
- 在 InsertItemTemplate 中使用 Bind 語法。
- 使用 RadioButtonLists 和 DropDownLists 進行資料輸入。
- 使用 CheckBoxes 進行資料輸入。
- 使用 FormView 進行插入。
- DetailsView 和 FormView 之間的權衡。
- 常見錯誤。
- 總結。
- 練習。

- 第13章:驗證。
- 驗證控制項概述。
- 什麼是驗證控制項?
- 驗證支援的情境?
- 驗證控制項的共同概念。
- 共同屬性。
- 驗證控制項的實作。
- 驗證在背後的運作方式。
- 多重驗證。
- 驗證控制項的類型。
- 資料情境中的驗證。
- 驗證總結。
- 驗證群組。
- 程式碼中的驗證。
- 常見錯誤。
- 總結。
- 練習。

- 第14章:商業物件作為資料來源。
- ObjectDataSource 控制項介紹。
- N-Tier 應用程式的層次。
- N-Tier 架構的優勢。
- 使用硬編碼資料的簡單物件。
- 綁定到硬編碼陣列。
- 使用泛型的物件。
- 綁定到資料來源的物件。
- 使用 VWD 建立具有資料的物件。
- 返回 DataSet 列表的物件。
- 修改資料的物件。
- 與資料物件的主從關係。
- 資料物件中的排序。
- 常見錯誤。
- 總結。
- 練習。

- 第15章:XML 和其他層次資料。
- 什麼是層次資料?
- 層次資料的類型。
- ASP.NET 2.0 層次資料控制項。
- XmlDataSource 和 TreeView 控制項。
- 資料綁定和格式化 TreeView。
- 使用 XmlDataSource 的 XPath。
- 在 TreeView 控制項中處理事件。
- 與其他控制項的層次資料。
- XmlDataSource 和 DropDownList。
- XmlDataSource 和 GridView。
- XmlDataSource 和 DataList。
- XmlDataSource 和具有嵌套的 DataList。
- SiteMapDataSource、SiteMapPath 和菜單控制項。
- 常見錯誤。
- 總結。
- 練習。

- 第16章:快取資料。
- 快取及其好處。
- 何時使用快取。
- 理解狀態。
- 理解狀態陳舊。
- ASP.NET 2.0 中的快取選項。
- 關於練習的資料說明。
- 基於時間的快取過期。
- 使用參數的快取。
- 實施過濾功能。
- SQL Server 快取失效。
- 快取部分頁面。
- 常見錯誤。
- 總結。
- 練習。

- 第17章:為資料控制項處理事件。
- 事件處理介紹。
- 當事件被觸發時的執行控制。
- 事件的類型。
- 編寫事件處理器的一般技術。
- 當事件被觸發時的值傳遞。
- 事件處理器的位置。
- 命令和自訂按鈕事件。
- 使用命令按鈕或命令欄位引發的事件。