5. Advanced Data
and Page Techniques
In Chapters 3 and 4, you saw how the data source
controls provide an interface between the display controls, such as
, and the underlying
data store, whether that is direct SQL statements to a database or
via a data or business layer. There are many times when the
existing functionality meets requirements, but there are also times
when you need more control over the process.
One of those times is when you need access to
the parameters of commands, both before and after the command is
executed. Another is when you need to trigger actions when the data
has been modified, so that other controls can update their
contents. Others times where you might need more control are
concurrency errors, such as what happens if more than one person
updates the same data at the same time. You might want to ensure
that when saving a record, the
is notified if someone else has
also changed that record.
SQLServer 2005 is not only an improved version
of SQL Server 2000, but offers a really exciting new feature: .NET
is built into the database. This means that a variety of things
that were written in T-SQL, such as stored procedures and
functions, can now be done with managed languages such as VB.NET or
C#. We're not going to examine those directly, but one topic worth
covering is the creation and use of user-defined types; these allow
you to extend the existing type system so that custom types in your
application code can be stored directly in the database.
When dealing with data,
from remote locations, performance is always an issue. For example,
consider the case where data is
from a Web Service, which
either responds slowly, or perhaps doesn't respond at all. You not
only slow the performance of an individual page while it waits for
its data, but you also affect the scalability of the Web site.
Asynchronous techniques allow you to solve the scalability issue.
So in this chapter we are going to cover the following:
The events of the data source controls
The events of the data display and edit
How to use pessimistic locking and handle
How to use asynchronous Web pages to improve
How to create and use custom types in SQL Server
All of these are great techniques that will help
you interact with data you need to display and get the best out of
your Web site.