O'Reilly logo

Programming ASP.NET, 3rd Edition by Dan Hurwitz, Jesse Liberty

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

Creating Data Objects by Hand

In all of the examples so far, you have created the DataSet object and its DataTable and DataRow objects by selecting data from the database. There are, however, occasions when you will want to fill a dataset or a table by hand.

For example, you may want to gather data from a user, and push that data into the database. It can be convenient to add records to a table manually and update the database from that table.

The dataset is an excellent transport mechanism for data. You may even want to create a dataset by hand only to pass it to another tier in your application where it will be used as a data source.

In the next example, you will create a dataset and populate three tables by hand. Once the tables are created, you’ll set constraints on a number of columns, set default values, establish identity columns, and create keys. In addition, you’ll establish a foreign key relationship between two tables, and you’ll create a data relation tying two tables together. It sounds like more work than it really is.

Details panel displayed

Figure 10-7. Details panel displayed

Bug Database Design

Rather than use the Northwind database for this exercise, you will create a database for tracking bugs in a software development project. Imagine that you have been asked to create a tool to manage bugs for a large development effort. You will be supporting three developers along with a user interface ...

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