Step by step learning ASP. net mvc 1.0 to create the NerdDinner sample program, Part 3

Source: Internet
Author: User

This article continues with the study and implements the NerdDinner sample program through ASP. net mvc 1.0 step by step.

Create a database

We will use the database to store all the Dinner and RSVP data of the NerdDinner application. Here, we use SQL Server 2008 to create and manage the NerdDinner database. You need to add two tables to the database, one for storing Dinners data, and the other for tracking RSVP.

As shown in, there is a NerdDinner database and a Dinners data table. The DinnerID field is set as the primary key and as the auto-increment field.

Next, follow the same steps to create an RSVP data table with three columns. Set the RsvpID column as the primary key, and set it to identity-auto-increment. Finally, save the table name RSVP, as shown in.

Set the foreign key relationship between tables

The NerdDinner database has two tables and one-to-multiple relationship is set. In this way, each Dinner record can be associated with zero or multiple RSVP records.

Open the RSVP table, right-click the DinnerID field, and select "Link ..." Shows the menu items.

In the pop-up dialog box, set the foreign key relationship between two tables. Click the Add button to add a new relation dialog box. After adding a link, click the... next to "table and column specification... As shown in.

Next, the dialog box for tables and columns is displayed, specifying the relationship between related tables and columns. Set one-to-multiple relationships, as shown in. Now, each record in the RSVP table is associated with a record in the Dinners table. SQL Server maintains data consistency, prevents users from adding new RSVP rows without corresponding Dinner records, and prevents users from deleting the Dinner records associated with RSVP rows.

Add data to DinnersData Table

Next we will add an example data to the Dinners table, which will be used in subsequent application development.

Today, we are here to continue translating ASP. net mvc eBook tomorrow-developing the NerdDinner sample program wizard. Welcome to http://blog.EntLib.com blog platform for more MVC learning materials.

Download link for related resources:

1. ASP. net mvc 1.0 official version released !!!

Http://forum.entlib.com/Default.aspx? G = posts & t = 464

2. Free ASP. net mvc eBook wizard-eBook download

Http://blog.entlib.com/entlibforum/archive/2009/03/12/asp.net-mvc-ebook.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.