Beginning ASP.NET 2.0 and Databases / Edition 1by John Kauffman
Pub. Date: 07/31/2006
ASP.NET is Microsoft's popular technology for creating dynamic web sites that pull unique information for each visitor rather than showing everyone the same static HTML pages. The introduction of the exciting 2.0 version allows for a far easier relationship between data and ASP.NET than ever before. In this book, bestselling author John Kauffman and Microsoft ASP.NET… See more details below
ASP.NET is Microsoft's popular technology for creating dynamic web sites that pull unique information for each visitor rather than showing everyone the same static HTML pages. The introduction of the exciting 2.0 version allows for a far easier relationship between data and ASP.NET than ever before. In this book, bestselling author John Kauffman and Microsoft ASP.NET data insider Bradley Millington guide you through the most important uses of ASP.NETworking with databases in your ASP.NET web sites.
As you progress from simple to more complex topics, you'll be introduced to the many additional ASP.NET and data connectivity tools that Microsoft's Web Platform and Tools team has released. Kauffman and Millington take you beyond the basics to discuss the permutations, pitfalls, and best practices that occur in real business scenarios.
What you will learn from this book
- Fundamentals of connecting web pages to databases
- The connections to Access, SQL Server, Oracle®, XML, and other data sources
- Various tricks and traps for displaying data in grids, lists, and trees
- How to allow users to change, add, and delete data
- Techniques for creating data objects and events
- Ways to handle data errors
Who this book is for
This book is for anyone who needs a web front-end or is looking to add data to a site. A comfortable level of understanding with ASP.NET version 1.x or ASP version 3.0 is recommended. Readers should also have some familiarity with databases.
Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.
Table of Contents
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.
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.
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.
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.
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.
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.
ShowHeader and ShowFooter.
Customizing Styles within a Table.
GridView and DetailsView Styles.
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.
Chapter 7: Sorting and Paging Data.
Requirements to Enable Sorting.
Understanding How ASP.NET 2.0 Manages Sorting.
Customizing Paging and Pager Navigation Tools.
Paging Theory and Alternatives.
The Relationship among Sorting, Paging, and Selecting.
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.
Selection in a List.
SelectedIndex and SelectedValue.
Chapter 9: Filtering and Master—Details 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.
Chapter 10: Displaying Data in Templated Controls and Data Binding.
Introduction to Templates.
Template Location and Scope.
Record Rendering: Repeat and Single.
Subsections of Templates.
Data Binding in Templates.
General Guidelines for Using Templated Controls.
GridView Template Columns.
DataList Control Internal Layout.
Templates in the DetailsView Control.
Comparison of the Templated Controls.
A Few More Advanced Ideas on Data Binding.
Chapter 11: Updating and Deleting Data.
Overview of Modifying.
DataKeyNames and Updates.
Update in a DetailsView.
Handle Nulls in Updates.
Delete to Remove Entire Records.
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.
Chapter 13: Validation.
Overview of Validation Controls.
What Are Validation Controls?
What Scenarios Do Validations Support?
Common Concepts of Validation Controls.
Implementation of Validation Controls.
How Validation Works behind the Scenes.
Types of Validation controls.
Validation in Data Scenarios.
Validation in Code.
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.
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.
Chapter 16: Caching Data.
Caching and Its Benefits.
When to Use Caching.
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.
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.
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 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.
Development of Files.
Appendix A: A Short and Practical Introduction to SQL Statements.
Appendix B: Exercise Answers.
and post it to your social network
Most Helpful Customer Reviews
See all customer reviews >