tailieunhanh - Beginning Visual Basic .NET Database Programming phần 2

Bây giờ thay đổi các bảng tiểu học trọng điểm để hiển thị bảng Products. Một lần nữa, khi bạn rời khỏi trường, mối quan hệ được lựa chọn và đặt tên cho mối quan hệ sẽ được tự động cập nhật. Bảng OrdersProducts vẫn được hiển thị như bảng chính nước ngoài. | Microsoft SQL Server 2000 Desktop Engine 36 . This creates the relationship with the Orders table so now we re ready to create the relationship with the Products table. To do so click the New button. 37 . Now change the Primary key table to show the Products table. Again when you leave the field the Selected relationship and Relationship name are automatically updated. The OrdersProductS table should still be showing as the Foreign Key table. Now select the ProductIdentifier in both the Primary Key and Foreign Key drop-down lists. At this point you have created the relationship with the Products table too. 38 . To see a list of existing relationships on the OrdersProducts table select the Selected relationship drop-down at the top of the Relationships dialog to see all those currently defined 25 Chapter 2 39 . Notice that both the relationships we have just created appear in the drop-down list. Close this window and the OrdersProducts table by clicking on the cross in the top right corner of each so that you return to the tables view. If you are prompted to save table changes click Yes. 40 . Double-click on the Products table and add some sample data. Remember that the Productldentifier field is generated by SQL Server so you do not have to fill in this field yourself. Try adding the record without entering values for the required fields just to see what happens. Then add a few valid records and close the datasheet view. 41 . Then open the Customers table and add some new customers. Again recall that you do not need to specify the CustomerNumber as it is automatically generated by SQL Server. Try adding a record without specifying one of the required fields to see what happens. Then add a couple of customers to the table and then close the datasheet view. 26 Microsoft SQL Server 2000 Desktop Engine 42. Op en the Orders record and fill in some information there too. See what happens when you try to specify a CustomerNumber that doesn t exist in the Customers table .

TÀI LIỆU MỚI ĐĂNG
6    132    0    22-11-2024