In the previous chapter, you created forms, but they did not interact with real data. In this chapter, you'll begin to extract data from the database and fill in your forms. You'll do this incrementally, adding complexity as you go. You'll put a premium on using data controls and letting the controls manage the "plumbing" of database interaction.
To see how to interact with a database, begin by creating a new web application that can be used to display information about the Northwind database. Call it
WebNorthWind, as shown in Figure 11-1.
Figure 11-1. Creating the WebNorthWind web site
You'll be working with the Customers table in the Northwind database, so rename your .aspx file from Default.aspx to Customers.aspx (don't forget to change the class name both in the code file and in the page directive!).
You need a connection to the database. You can explicitly create one, or you can use a control that depends on having a connection and one will be created for you. Let's start by explicitly creating one.
control onto the form, as shown in Figure 11-2.
Figure 11-2. Data source control
SqlDataSource control will appear on your form, as shown in Figure 11-3.
Figure 11-3. SqlDataSource control ...