IMetabase.IsDisconnected

Syntax

IsDisconnected: Boolean;

IsDisconnected(): boolean;

Description

The IsDisconnected method returns that there is no connection with the DB server.

Comments

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 it, the RefreshO method with corresponding value of the MetabaseRefreshOptions.Reconnect parameter is used.

Example

Executing the example requires a form and a button named Button1 on it.

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;
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    MB: IMetabase;
Begin
    MB := Self.Metabase;
    
Try
        MB.Refresh();
    
Except
        
If MB.IsDisconnected() Then
            MB.RefreshO(
            MetabaseRefreshOptions.mroReconnect 
Or
            MetabaseRefreshOptions.mroObjects 
Or
            MetabaseRefreshOptions.mroNoRefreshEvent, -
1);
        
End If;
    
End Try;
End Sub;

After executing the example pressing the button updates the tree of repository objects. If an error, connected with the loss of connection with the DB server, occurs during updating, the connection is restored.

See also:

IMetabase | IMetabase.RefreshO