TAILIEUCHUNG - Issues Involved When Updating the Primary Key of a Parent Row

Issues Involved When Updating the Primary Key of a Parent Row In this section, you'll learn about the issues involved when attempting to update the primary key in a parent DataTable | Issues Involved When Updating the Primary Key of a Parent Row In this section you ll learn about the issues involved when attempting to update the primary key in a parent DataTable and then pushing the update to the underlying database table. The issues occur when the child database table already contains rows that use the primary key you want to change in the parent table. The examples in this section will use the Customers and Orders table which are related through the foreign key on the CustomerlD column of the Orders table to the CustomerlD column of the Customers table. As you ll learn you re much better off not allowing changes to the primary key column of a table. If you allow changes to the primary key column then as you ll see shortly you can run into problems when pushing the change to the database. Instead you should set the ReadOnly property to true for the primary key DataColumn in your parent DataTable and also set ReadOnly to true for the foreign key DataColumn in your child DataTable. That prevents changes to the values in these DataColumn objects. If you really need to change the primary key and foreign key values you should delete and then recreate the rows in the database with the new primary key and foreign key values. You can control how updates and deletes are performed using the properties of the foreign key in the SQL Server database and also the UpdateRule and DeleteRule properties of a ForeignKeyConstraint object. You ll explore both of these items in the following sections. Controlling Updates and Deletes Using SQL Server You can control how updates and deletes are performed using SQL Server by setting the properties of the foreign key. You set these properties using the Relationships tab of a database table s Properties dialog box. You open this dialog box in Enterprise Manager for the Orders table by performing the following steps 1. Right-click the Orders table in the Tables node of Enterprise Manager. 2. Select Design Table from the .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.