DB2 9 and ASP.net 2.0 build next-generation applications

Source: Internet
Author: User
Tags db2 new features visual studio

Brief introduction

This tutorial describes the benefits of using the DB2 with the ASP.net 2.0 master-slave composite relationship enhancements. In the past, it was often difficult to support a master-subordinate composite relationship by connecting two data grids, but now, with Visual Studio 2005 and ASP.net 2.0, you can build a master-slave composite application with just the right controls.

This tutorial demonstrates how to build a master-slave composite application without writing code. Instead of writing code, we build a sample application using the grid view and Details view control in ASP.net 2.0, which is to show employees in a specific department of the company.

Why use DB2 9, which supports ASP.net 2.0?

With full support for IBM native XML and support for Microsoft's industry mainstream development platform. NET, DB2 9 has led to new changes in the Data management field. DB2 now supports a number of. NET-related features, which makes it the best partner for. NET databases. With these two powerful technologies, you can create data-driven Web applications with little time to save costs and increase developer productivity.

ASP.net 2.0 has new features that make it very worthwhile for web developers to try. This tutorial demonstrates how to use the new GridView and DetailsView of ASP.net 2.0 to retrieve the master-slave composite data for the DB2 database.

Create a table

This tutorial demonstrates how to use some new controls to build an application that is based on a master-slave composite structure, with very little code or no code to write. The example in the tutorial shows how to create a typical HR scenario application--the application that is created shows the employee information for a specific department.

This scenario requires the creation of two separate table--department tables and employee tables. To create both tables, you can reuse the sample database, which was created during the installation process by DB2 9.

The structure of the table is shown in listings 1 and 2:

Code

Sample code for the list 1:DEPT1 table

DDL Statements for table "ANILM"."DEPT1"
  ------------------------------------------------
  CREATE TABLE ANILM.DEPT1 (
  DEPTNO CHAR (10) NOT NULL,
  DNAME VARCHAR (50),
  LOCATION VARCHAR (10))
  DDL Statements for primary key on Table "ANILM"."DEPT1"
  ALTER TABLE ANILM.DEPT1
  ADD CONSTRAINT PK_DEPTNO PRIMARY KEY
  (DEPTNO);
  DDL Statements for foreign keys on Table "ANILM"."EMP1"
  ALTER TABLE ANILM.EMP1
  ADD CONSTRAINT FK_DEPTNO FOREIGN KEY
  (DEPTNO)
  REFERENCES ANILM.DEPT1
  (DEPTNO) 

Listing 2. Sample code for the EMP1 table

  DDL Statements for table "ANILM"."EMP1"
  ------------------------------------------------
  CREATE TABLE ANILM.EMP1 (
  EMPNO CHAR (10) NOT NULL,
  ENAME VARCHAR (40),
  DEPTNO CHAR (10),
  SALARY DECIMAL (10, 2),
  EMAIL VARCHAR (50))
  DDL Statements for primary key on Table "ANILM"."EMP1"
  -------------------------------------------------------------
  ALTER TABLE ANILM.EMP1
  ADD CONSTRAINT PK_EMPNO PRIMARY KEY
  (EMPNO);

Related Article

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.