Update Method

Microsoft Office Web Components Visual Basic

Update Method

You use the Update method to write data contained in an XML map to a data source bound to a SOAP Web service. Returns Nothing.

expression .Update (ShowDialogs)

expression    Required. An expression that returns an XmlDataBinding object.

ShowDialogs   Optional Boolean. Specifies whether a dialog box is displayed if the Update method encounters an error that is returned by the Spreadsheet component itself. When ShowDialogs    is set to True, a dialog box is displayed if the Update method encounters an error returned by the Spreadsheet component. When ShowDialogs is set to False, dialog boxes for Spreadsheet component errors are not displayed. The default is False.

Note  The ShowDialogs argument does not control whether a dialog box will be displayed for errors external to the Spreadsheet component, such as errors returned by scripting components. To prevent a dialog box from displaying for errors external to the Spreadsheet component, you must trap those errors in your script.

Remarks

If the Update method fails, the BindingError event of the Spreadsheet component will fire, and any scripting errors will be returned. To catch an update error you must add code to the BindingError event, or trap errors in script. During asynchronous binding, any effort to work with an XmlDataBinding object programmatically will fail. You can use the Async property of the XmlDataBinding object to determine if a binding supports asynchronous binding. You use the BindingInProgress property of the XmlDataBinding object to determine of an asynchronous binding is in progress.

Example

You can add code to the BindingCompleted event of the Spreadsheet component that calls the Update method or you can use the BindingInProgress property to determine if data binding is in progress. The following example uses the Update method to write data back to the data source of a SOAP Web service for all XmlDataBinding objects in a Spreadsheet component:

    Sub UpdateBinding (Spreadsheet1)

    Spreadsheet1.ActiveWorkbook.XmlDataBindings.Item(2).Update

End Sub

Sub Spreadsheet1_BindingCompleted(bindingID, Action)

    If Spreadsheet1.ActiveWorkbook.XmlDataBindings.Item(bindingID).CanUpdate = True Then
        ' Write code here to perform any additional actions on this update binding.
    End If

End Sub
  

Note  For information on trapping the BindingCompleted event from script running in a Web page, see the BindingCompleted event topic.