3. Data BindingIN THIS CHAPTER, we look at the declarative data sources and the new data-bound controls introduced with ASP.NET 2.0. Of all the features introduced in this release, declarative data binding undoubtedly has the most impact on developers. Instead of programmatically populating controls with queries issued through ADO.NET, data source controls provide a way of populating controls with data declaratively. The end result is that developers end up writing much less code to accomplish the same tasks. This model is flexible enough to support many different types of data access as well, ranging from standard parameterized SQL statements to stored procedure calls to full-blown object-oriented data access layers. Most of the samples shown in this chapter are based on a database called "moviereviews" that contains two tables: movies and reviews. Each table has a single primary key marked as an identity column, and there is a foreign key reference from the reviews table to the movies table. Listing 3-1 shows the creation script for these two tables.[1]
Listing 3-1. Creation script for moviereviews sample database
|