TAILIEUCHUNG - Avoiding Referential Integrity

[ Team LiB ] Recipe Avoiding Referential Integrity Poblems When Updating the Data Source Problem You sometimes get referential integrity errors when you update a DataSet that contains related parent, child, and grandchild records back to the underlying data source, but want to perform the update without errors. | Team LiB Recipe Avoiding Referential Integrity Problems When Updating the Data Source Problem You sometimes get referential integrity errors when you update a DataSet that contains related parent child and grandchild records back to the underlying data source but want to perform the update without errors. Solution Use one DataAdapter for each DataTable to update the deleted updated and inserted rows as shown in the following example. The schema of table TBL0606Parent used in this solution is shown in Table 6-2. Table 6-2. TBL0606Parent schema Column name Data type Length Allow nulls ParentId int 4 No Fieldl nvarchar 50 Yes Field2 nvarchar 50 Yes The schema of table TBL00606Child used in this solution is shown in Table 6-3. Table 6-3. TBL0606Child schema Column name Data type Length Allow nulls ChildId int 4 No ParentId int 4 No Field3 nvarchar 50 Yes Field4 nvarchar 50 Yes The schema of table TBL0606Grandchild used in this solution is shown in Table 6-4. Table 6-4. TBL0606Grandchild schema Column name Data type Length Allow nulls GrandchildId int 4 No ChildId int 4 No Field5 nvarchar 50 Yes Field6 nvarchar 50 Yes The sample uses 12 stored procedures SP0606_GetParent Used to retrieve a single record from the Parent table if the optional @ParentId parameter is specified or all Parent records if it is not SP0606_DeleteParent Used to delete the record specified by the @ParentId parameter from the Parent table SP0606_InsertParent Used to insert a record into the Parent table and return the ParentId identity value for the new record SP0606_UpdateParent Used to update all field values for the record in the Parent table specified by the @ParentId input parameter SP0606_GetChild Used to retrieve a single record from the Child table if the optional @ChildId parameter is specified or all Child records if it is not SP0606_DeleteChild Used to delete the record specified by the @ChildId parameter from the Child table SP0606_InsertChild Used to insert a record into the Child

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.