Beginning ASP.NET 2.0 E-Commerce in C# 2005 From Novice to Professional PHẦN 3

Cũng lưu ý các điều khiển phân trang, xuất hiện trong bất cứ danh sách sản phẩm có chứa nhiều hơn so với một số thiết lập của sản phẩm. Hình 3-3. "Sinh nhật" Trong bất kỳ trang hiển thị sản phẩm, bạn có thể nhấp vào tên hoặc hình ảnh của một sản phẩm để xem trang chi tiết của nó sản phẩm (xem Hình 3-4). | CHAPTER 4 CREATING THE PRODUCT CATALOG PART II 119 7. Expand your database node in Database Explorer right-click the Database Diagrams node and select Add New Diagram from the context menu alternatively you can choose Data Add New Diagram . If a dialog box that asks about creating database objects required for diagramming shows up click Yes. 8. You ll see a dialog box as shown in Figure 4-12. Click Add four times to add all your tables to the diagram and then click Close. Figure 4-12. Adding tables to the diagram 9. Feel free to zoom the window and rearrange the tables on the diagram to fit nicely on the screen. With the default options your diagram will look like Figure 4-13. Figure 4-13. Adding tables to the diagram 120 CHAPTER 4 CREATING THE PRODUCT CATALOG PART II To enforce the Many-to-Many relationship between Category and Product you need to add two FOREIGN KEY constraints. In this exercise you ll create these constraints visually. 10. Click the ProductID key in the ProductCategory table and drag it over the ProductID column of the Product table. The dialog box that adds a new foreign-key relationship shows up already filled with the necessary data see Figure 4-14 . Figure 4-14. Creating a new foreign key 11. Click OK to confirm adding the foreign key and then click OK again to close the Foreign Key Relationship dialog box. 12. Create a new relationship between the Category and ProductCategory tables on their CategoryID columns in the same way you did in steps 11 and 12. The diagram now reflects the new relationships see Figure 4-15 . Figure 4-15. Viewing tables and relationships using the database diagram CHAPTER 4 CREATING THE PRODUCT CATALOG PART II 121 13. Press Ctrl S to save your diagram and the changes you made to your tables. When asked for a diagram name type CatalogDiagram. You ll be warned that Product Category and Productcategory will be saved to the database. Click Yes to confirm. 14. Populate the Productcategory table by running the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.