IsDisconnected: Boolean;
The IsDisconnected method returns that there is no connection with the DB server.
The method returns True if connection with the DB server is not available, and returns False if connection is available. In case of connection unavailability the user may try to restore it. To do this, use the RefreshO method with corresponding value of the MetabaseRefreshOptions.Reconnect parameter.
Executing the example requires a form and a button named Button1 on the form.
Add a link to the Metabase system assembly.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
Begin
MB := MetabaseClass.Active;
Try
MB.Refresh;
Except
If MB.IsDisconnected Then
MB.RefreshO(
MetabaseRefreshOptions.Reconnect Or
MetabaseRefreshOptions.NoObjects Or
MetabaseRefreshOptions.NoRefreshEvent);
End If;
End Try;
End Sub Button1OnClick;
After executing the example pressing the button updates the tree of repository objects. If an error occurs due to the loss of connection with the database server during updating, the connection is restored.
See also: