Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_ado_rds thread: About using another way to saving changes in RDS?


Message #1 by "x.chen" <wo21@c...> on Mon, 3 Sep 2001 19:44:28
HI:



one day i read the article about 

How to use RDS to get and maintain data on a Remote Server (by Carl D. 

Prothman).



this article introduct another way saving changes.



the code in below:





*****************************************************

With oRDC.Recordset



  ' Reduce the Recordset to only pending changes



  .Filter = adFilterPendingRecords



 



  ' If there are any changes to be made



  If .RecordCount Then



    



    ' Perform in-line error handling.  Note an error is raised



    ' if there are conflicts when UpdateBatch is run



    On Error Resume Next



    



    ' Only send changes to the server



    .MarshalOptions = adMarshalModifiedOnly



    



    ' Update the remote database



    .UpdateBatch adAffectGroup



    



    ' If there was a conflict in performing the UpdateBatch



    If Err.Number Then



    



        ' Filter for conflicts 



        .Filter = adFilterConflictingRecords



 



        ' Let the user know how many conflicts occurred



       MsgBox CStr(.RecordCount) & " conflict(s) occurred during save." 



        



        ' Get the latest values (underlying) from the remote database 



        .Resync adAffectAllChapters, adResyncUnderlyingValues



        







        ' Move to the first record in the local recordset



        .MoveFirst



 



        ' For each conflict found



        Do While Not .EOF



 



            ' Show conflicts to user



            MsgBox "The following record: " & vbCrLf & _



            "'" & .Fields(0).OriginalValue & "', " & _



            "'" & .Fields(1).OriginalValue & "', " & _



            "'" & .Fields(2).OriginalValue & "'" & _



            vbCrLf & vbCrLf & _



            "has already been changed to:" & vbCrLf & _



            "'" & .Fields(0).UnderlyingValue & "', " & _



            "'" & .Fields(1).UnderlyingValue & "', " & _



            "'" & .Fields(2).UnderlyingValue & "'"



            



       ' Handle conflicts ¨C based on business rules



       ' Ask user what to do



       ' - Overwrite the underlying values (keep current values)



       ' - Keep the underlying values (discard current values)



       ' ¨C Revert back to original value (discard current and  



       '   underlying values)



 



            .MoveNext



        Loop



    End If   



    



    oRDC.Refresh   ' Get a new snap shot of the remote data



  End If  ' End if changes



End With



*****************************************************



when i test the code ,it seems nothing change happen.

Does anyone could tell me why?





Any suggestions appreciated.



Thanks



chen

  Return to Index