One of the stated goals of .NET 2.0 is to push more of the plumbing into the .NET Framework and to provide controls for Windows and web developers that reduce the amount of code they will write. Nowhere is this seen more profoundly than when writing code for interacting with databases.
In .NET 2.0 you write far less code to set up database interactions, but you do not sacrifice control when creating, displaying, updating, or deleting data. In fact, you can create a very powerful sorted, paged grid of data from your database with virtually no code at all.
You will need to have Northwind installed on your database to do the labs in this chapter. If you have installed SQL Server (Developer or Production version) or Access, you already have Northwind. If you have SQL Server Express, download the appropriate setup files from the Microsoft web site (http://www.microsoft.com).
First, create a new web application and name it
DataBindingNoCode. Click the Data tab of the
Toolbox and drag a
control onto the default web form, Default.aspx.
Your first job is to set up the database connection. You can do this in a number of ways, but it's easiest to click the smart tag and drop down the Choose Data Source list. Click <New data source...>, as shown in Figure 5-1.
Figure 5-1. Creating a new data source
With .NET 2.0 you ...