- •Preface
- •Who Should Read This Book
- •Organization and Presentation
- •Contacting the Authors
- •Acknowledgments
- •Contents
- •Introduction
- •Why Microsoft .NET?
- •The Microsoft .NET Architecture
- •Internet Standards
- •The Evolution of ASP
- •The Benefits of ASP.NET
- •What Is .NET?
- •.NET Experiences
- •.NET Clients
- •.NET Services
- •.NET Servers
- •Review
- •Quiz Yourself
- •Installation Requirements
- •Installing ASP.NET and ADO.NET
- •Installing the .NET Framework SDK
- •Testing Your Installation
- •Support for .NET
- •Review
- •Quiz Yourself
- •Designing a Database
- •Normalization of Data
- •Security Considerations
- •Review
- •Quiz Yourself
- •Creating a Database
- •Creating SQL Server Tables
- •Creating a View
- •Creating a Stored Procedure
- •Creating a Trigger
- •Review
- •Quiz Yourself
- •INSERT Statements
- •DELETE Statements
- •UPDATE Statements
- •SELECT Statements
- •Review
- •Quiz Yourself
- •The XML Design Specs
- •The Structure of XML Documents
- •XML Syntax
- •XML and the .NET Framework
- •Review
- •Quiz Yourself
- •ASP.NET Events
- •Page Directives
- •Namespaces
- •Choosing a Language
- •Review
- •Quiz Yourself
- •Introducing HTML Controls
- •Using HTML controls
- •How HTML controls work
- •Intrinsic HTML controls
- •HTML Control Events
- •The Page_OnLoad event
- •Custom event handlers
- •Review
- •Quiz Yourself
- •Intrinsic Controls
- •Using intrinsic controls
- •Handling intrinsic Web control events
- •List Controls
- •Rich Controls
- •Review
- •Quiz Yourself
- •Creating a User Control
- •Adding User Control Properties
- •Writing Custom Control Methods
- •Implementing User Control Events
- •Review
- •Quiz Yourself
- •Common Aspects of Validation Controls
- •Display property
- •Type Property
- •Operator Property
- •Using Validation Controls
- •RequiredFieldValidator
- •RegularExpressionValidator
- •CompareValidator
- •RangeValidator
- •CustomValidator
- •ValidationSummaryx
- •Review
- •Quiz Yourself
- •Maintaining State Out of Process for Scalability
- •No More Cookies but Plenty of Milk!
- •Out of Process State Management
- •Review
- •Quiz Yourself
- •Introducing the Key Security Mechanisms
- •Web.config and Security
- •Special identities
- •Using request types to limit access
- •New Tricks for Forms-based Authentication
- •Using the Passport Authentication Provider
- •Review
- •Quiz Yourself
- •ASP.NET Updates to the ASP Response Model
- •Caching with ASP.NET
- •Page Output Caching
- •Absolute cache expiration
- •Sliding cache expiration
- •Fragment Caching
- •Page Data Caching
- •Expiration
- •File and Key Dependency and Scavenging
- •Review
- •Quiz Yourself
- •A Brief History of Microsoft Data Access
- •Differences between ADO and ADO.NET
- •Transmission formats
- •Connected versus disconnected datasets
- •COM marshaling versus text-based data transmission
- •Variant versus strongly typed data
- •Data schema
- •ADO.NET Managed Provider Versus SQL Managed Provider
- •Review
- •Quiz Yourself
- •Review
- •Quiz Yourself
- •Creating a Connection
- •Opening a Connection
- •Using Transactions
- •Review
- •Quiz Yourself
- •Building a Command
- •Connection property
- •CommandText property
- •CommandType property
- •CommandTimeout property
- •Appending parameters
- •Executing a Command
- •ExecuteNonQuery method
- •Prepare method
- •ExecuteReader method
- •Review
- •Quiz Yourself
- •Introducing DataReaders
- •Using DataReader Properties
- •Item property
- •FieldCount property
- •IsClosed property
- •RecordsAffected property
- •Using DataReader Methods
- •Read method
- •GetValue method
- •Get[Data Type] methods
- •GetOrdinal method
- •GetName method
- •Close method
- •Review
- •Quiz Yourself
- •Constructing a DataAdapter Object
- •SelectCommand property
- •UpdateCommand, DeleteCommand, and InsertCommand properties
- •Fill method
- •Update method
- •Dispose method
- •Using DataSet Objects
- •DataSetName property
- •CaseSensitive property
- •Review
- •Quiz Yourself
- •Constructing a DataSet
- •Tables property
- •TablesCollection Object
- •Count property
- •Item property
- •Contains method
- •CanRemove method
- •Remove method
- •Add method
- •DataTable Objects
- •CaseSensitive property
- •ChildRelations property
- •Columns property
- •Constraints property
- •DataSet property
- •DefaultView property
- •ParentRelations property
- •PrimaryKey property
- •Rows property
- •Dispose method
- •NewRow method
- •Review
- •Quiz Yourself
- •What Is Data Binding?
- •Binding to Arrays and Extended Object Types
- •Binding to Database Data
- •Binding to XML
- •TreeView Control
- •Implement the TreeView server control
- •Review
- •Quiz Yourself
- •DataGrid Control Basics
- •Binding a set of data to a DataGrid control
- •Formatting the output of a DataGrid control
- •Master/Detail Relationships with the DataGrid Control
- •Populating the Master control
- •Filtering the detail listing
- •Review
- •QUIZ YOURSELF
- •Updating Your Data
- •Handling the OnEditCommand Event
- •Handling the OnCancelCommand Event
- •Handling the OnUpdateCommand Event
- •Checking that the user input has been validated
- •Executing the update process
- •Deleting Data with the OnDeleteCommand Event
- •Sorting Columns with the DataGrid Control
- •Review
- •Quiz Yourself
- •What Is Data Shaping?
- •Why Shape Your Data?
- •DataSet Object
- •Shaping Data with the Relations Method
- •Review
- •Quiz Yourself
- •OLEDBError Object Description
- •OLEDBError Object Properties
- •OLEDBError Object Methods
- •OLEDBException Properties
- •Writing Errors to the Event Log
- •Review
- •Quiz Yourself
- •Introducing SOAP
- •Accessing Remote Data with SOAP
- •SOAP Discovery (DISCO)
- •Web Service Description Language (WSDL)
- •Using SOAP with ASP.NET
- •Review
- •Quiz Yourself
- •Developing a Web Service
- •Consuming a Web Service
- •Review
- •Quiz Yourself
- •ASP and ASP.NET Compatibility
- •Scripting language limitations
- •Rendering HTML page elements
- •Using script blocks
- •Syntax differences and language modifications
- •Running ASP Pages under Microsoft.NET
- •Using VB6 Components with ASP.NET
- •Review
- •Quiz Yourself
- •Preparing a Migration Path
- •ADO and ADO.NET Compatibility
- •Running ADO under ASP.NET
- •Early Binding ADO COM Objects in ASP.NET
- •Review
- •Quiz Yourself
- •Answers to Part Reviews
- •Friday Evening Review Answers
- •Saturday Morning Review Answers
- •Saturday Afternoon Review Answers
- •Saturday Evening Review Answers
- •Sunday Morning Review Answers
- •Sunday Afternoon Review Answers
- •What’s on the CD-ROM
- •System Requirements
- •Using the CD with Windows
- •What’s on the CD
- •The Software Directory
- •Troubleshooting
- •ADO.NET Class Descriptions
- •Coding Differences in ASP and ASP.NET
- •Retrieving a Table from a Database
- •Displaying a Table from a Database
- •Variable Declarations
- •Statements
- •Comments
- •Indexed Property Access
- •Using Arrays
- •Initializing Variables
- •If Statements
- •Case Statements
- •For Loops
- •While Loops
- •String Concatenation
- •Error Handling
- •Conversion of Variable Types
- •Index
A P P E N D I X
A
Answers to Part Reviews
This appendix provides the answers for the Part Review questions.
Friday Evening Review Answers
1.A
2.False. A Web server’s primary responsibility is to handle HTTP requests.
3.False. The two primary protocols for Internet client/server communications are TCP/IP and HTTP.
4.D
5.False. Windows 3.1 is not a supported .NET platform. However, Windows 98, ME, NT, 2000, and XP can run .NET applications. ASP.NET Server Side Applications are, however, limited to 2000 and XP Platforms for development and production.
6.IIS 4.0
7.No. Installing the final release of the .NET SDK over the Beta Releases is not recommended.
8.No. Installing the .NET SDK side by side with your Visual Studio 6.0 or other applications is supported.
9.True. A database in the most general terms can be thought of as a collection of tables. A database can also contain many other objects such as the relationships between tables, stored procedures, triggers, and views.
10.C
11.True
12.False. Database tables are composed of rows and columns.
13.C
14.True. Either Query Analyzer or Enterprise Manager can be used to manage a SQL Server database and its constituent objects.
310 |
Appendix A |
15.B
16.False. SQL Server is a software application, not hardware.
17.False. The T-SQL statement used to create a new database is CREATE DATABASE.
Saturday Morning Review Answers
1.True
2.Create, Retrieve, Update, Delete
3.C. The SQL INSERT statement is used to add data to a table.
4.False. The field value needs be enclosed in single quotes since it is a string. The correct SQL statement is INSERT INTO t_bands (band_title) VALUES (‘Hootie & The Blowfish’).
5.True
6.Hierarchical
7.True. XML is actually a subset of SGML.
8.False. XML was designed to work with any application.
9.False. ASP.NET pages are event-based. When an ASP.Net page is loaded a series of events, including Page_Load, are fired.
10.Events
11.Page_Load, Page_Unload
12.C
13.True. HTML controls maintain their state between client requests by utilizing the hidden “VIEWSTATE” form field.
14.False. HTML controls generate HTML code specific to the requesting browser type.
15.A
16.C
17.False
18.False. Web controls can be bound to many types of data stores including XML, arrays or COM objects.
19.False. ASP.NET Controls can be programmatically added to a page at run-time.
20.C
21.False. ASP.NET User controls have an .ascx file extension.
22.True. You can modularize the design of your application by encapsulating frequently used presentation logic in User controls.
23.False. <html>, <body>, and <form> tags should not be included in User controls. By excluding these HTML tags from User controls, you will be less limited in where you can use the controls.
24.A
Answers to Part Reviews |
311 |
Saturday Afternoon Review Answers
1.False. The required field validator can be used with controls supporting user input.
2.^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([a-zA-Z0-9\- \.]+))\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$, which will validate a series of letters or numbers regardless of capitalization, including “_” and “-”, ^([a-zA-Z0-9_\-\.]+), followed by a literal @ character, followed by either an IP address or alternately a domain name using a valid extension such as COM, BIZ, and so on.
3.True. Multiple Validation controls can be used to validate a single control.
4.A
5.A
6.Out-of-process
7.Stores session state out-of-process, allowing you to run your application across multiple servers; Supports request-based load balancing; Provides adequate redundancy, reliability, and uptime when used in conjunction with clustering and hardware or software load balancing; Provides ability to support periodic “code rot” purges; Provides ability to partition an application across multiple worker processes.
8.Stores session state out-of-process, allowing you to run your application across multiple servers; Supports request-based load balancing; Provides extensive redundancy, reliability, and uptime when used in conjunction with clustering and hardware or software load balancing; Provides ability to support periodic “code rot” purges; Provides ability to partition an application across multiple worker processes; Provides ability to partition an application across multiple Web farm machines, Additionally the use of SQL Server provides the use of the Enterprise series of features in terms of memory optimization, clustering, database mirroring, failover and scalability that is less easily achieved using the State Server approach.
9.Authentication
10.Impersonation
11.A
12.<authorization>
13.A
14.C
15.TimeSpan.Zero provides an absolute expiration.
16.When you first insert an object into the cache.
17.False. The Recordset object is a traditional ADO object. .NET uses a series of objects, including DataReader and DataSet objects, to mimic the Recordset object’s functionality.
18.True
19.True. The DataSet object can contain multiple tables, in the form of DataTable objects, as well the relationships between the tables.
312 |
Appendix A |
20.True
21.False. An object is an instance of a class.
22.Object Oriented Programming or OOP
23.True
24.New
Saturday Evening Review Answers
1.D
2.A
3.False. A Connection object, either a SQLConnection or an OLEDBConnection, can be created through a Command object.
4.C
5.True
6.False. The ADO.NET Command objects provide several constructors.
7.C
8.CommandType
9.True. You can only move forward through a DataReader object.
10.OLEDBCommand
11.False. A DataReader can only be created through a Command object.
12.False. You can only move forward through a DataReader object.
13.False. The DataSet object can contain multiple tables, in the form of DataTable objects, as well the relationships between the tables.
14.True.
15.SelectCommand
16.Fill
Sunday Morning Review Answers
1.True. A DataSet can be created explicitly through a variety of constructors.
2.True. A DataSet can contain numerous constituent objects, most notably
DataTable objects.
3.Count
4.Item
5.Data binding
6.True
7.True. Setting a control’s AutoPostBack property to “true” forces the page in which it contained to repost when its state is changed.