One use of a disconnected recordset is to provide offline updating. A client can spend as much time as needed reviewing and editing data while disconnected from the data source.

Sending Batched Changes to the Data Source

Using the Update method, all changes to a disconnected recordset are cached on the client. Once reconnected, use the UpdateBatch method to send the changes to the data source.

The following example code sends all cached changes to the data source:

Sub cmdUpdateAll_Click()
    rsStudents.UpdateBatch
End Sub
  

Conflict Management Issues

When updating records after reconnecting to the data source, you should consider the possibility that conflicts may arise due to concurrent activity by other users of the data source. ADO will report conflicts and retrieve information about conflicts when asked. However, it is your responsibility to specify what types of conflicts ADO should report, request details about the conflicts, and supply code to handle the different types of conflicts in a manner that is appropriate for your application.

After you call the UpdateBatch method, you will need to determine if conflicts did occur and then supply the appropriate code to resolve each type of conflict in a way that makes sense for your application. It is advisable to wrap your batch updates and associated conflict resolution in a transaction to ensure that additional changes to the data source do not occur between the time you identify and then handle the conflicts.

For more information about managing conflicts, read the article "UpdateBatch Method (ADO)" in Platform SDK Help.

Canceling a Batch Update

Before the UpdateBatch method is used, your application can cancel all the changes that are in the client's cache. Use the CancelBatch method to reset the recordset to its original state.

The following example code prompts the user to submit all batched changes:

Sub cmdUpdateAll_Click()
    If MsgBox("Submit all changes?", vbYesNo) = vbYes Then
        rsStudents.UpdateBatch
    Else
        rsStudents.CancelBatch
    End If
End Sub