O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4: Saving and Retrieving Data

Answers to Quiz Questions

  1. A DataSource control.

  2. Binding.

  3. A connection string is a string that contains the information necessary to connect to a database on a server. You can store the connection string in the web. config file for later use.

  4. Create (add a new record), Retrieve, Update (edit), and Delete.

  5. Use the GridView's Smart Tag and the "Choose Data Source" drop-down list.

  6. Turn on paging by clicking the Smart Tag, and selecting Enable Paging.

  7. It safeguards your data by only writing changes to the database if none of the records have changed since the records were read.

  8. Enable Updating and Deleting, from the Smart Tag.

  9. Create an event handler for the RowDataBound event.

  10. Use a WHERE clause.

Answers to Exercises

Exercise 4-1. Here's one way to get a page that looks like Figure 4-27:

  1. Create a new web site as usual. Name it Exercise 4-1.

  2. Drag a SqlDataSource control onto the Design view.

  3. Drag a GridView control onto the Design view. Click the GridView's Smart Tag, go to the "Choose Data Source" drop-down list, and select SqlDataSource1.

  4. Click "Configure Data Source" in the Smart Tag. The Configure Data Source Wizard starts. You can use the connection string from the other exercises in this chapter. Click Next.

  5. On the next page, click the radio button marked "Specify columns from a table or view," and select the Product table from the drop-down list. Check the boxes for ProductID, Name, ProductNumber, Color, and ListPrice. The Wizard should look like Figure C-2 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required