RAD Studio for Microsoft .NET
|
This topic includes information about:
In a master-detail application, the application typically uses an OnApplyChanges event to send the DataSet changes to the server. It is necessary for the master data adapter's update method (in BDP.NET, the AutoUpdate event) to be called prior to the detail data adapter's update method. Otherwise, insertion of detail rows fails if the master row has not yet been inserted. If the master row is deleted prior to the detail row, the server might return an error.
The property CascadingDeletes has been added to the DBWebDataSource control. The CascadingDeletes property specifies how the server deletes rows in master-detail applications. The CascadingDeletes property provides the following three options:
This option does not allow deletion of a master row containing detail rows. This option should be used when the server enforces a foreign constraint between master and detail, but it does handle cascading deletes. You must:
This option allows deletion of the master row. This option should be specified whenever the server is set up to automatically handle cascading deletes. When a master row is deleted, the detail rows will automatically disappear from view. Any time prior to applying the change, you can undo the parent row deletion and all the detail rows come back into view. If the server is not set up to handle cascading deletes, an error may occur when attempting to send changes to the server.
This option automatically deletes all detail rows whenever a master row is deleted. This option should be specified whenever there are no foreign key constraints between the master-detail tables on the server. Like the ServerCascadeDelete option, when a master row is deleted, the detail rows will automatically disappear from view. Any time prior to applying the change, it is possible to undo the master row deletion to redisplay the detail rows. If you specify this option and foreign key constraints exist between master and detail tables, an error will be thrown by the server when attempting to delete the master table.
In a master-detail application, the application typically uses an OnApplyChanges event to send the DataSet changes to the server. It is necessary for the update method of the master data adapter (in BDP.NET, the AutoUpdate event) to be called prior to the update method of the detail data adapter. Otherwise, insertion of detail rows fails if the master row has not yet been inserted. If the master row is deleted prior to the detail row, the server might return an error.
The property CascadingUpdates has been added to the DBWebDataSource control. This property specifies how the server updates foreign-key values in master-detail applications. The CascadingUpdates property provides the following three options:
This option does not allow changes to the foreign key value of a master row if it has any associated detail rows. This option is the default value for the CascadingUpdates property.
This option allows you to change the foreign key value of the master row. You should use this option whenever the server automatically handles cascading updates. When the foreign key value of a master row is changed, the key value is changed automatically in the detail rows. Anytime prior to applying the change, you can undo the change to the master row and all the detail key changes will be undone also. If the server is not set up to handle cascading updates, an error might occur when attempting to update the changes to the server.
This option also allows changing the foreign key value of the parent row, but should be used whenever there is no foreign key between the master and detail tables on the server.
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|