IsConnected

The IsConnected method of an object of ClassType clsDatasource verifies the connection to the data source specified by the ConnectionString property. If the data source is not connected, the method attempts to connect to the source.

Syntax

bRet = objDS.IsConnected(Error)

bRet
A Boolean variable that receives the returned value: True is returned if the data source is connected; False if the connection cannot be established.
objDS
An object of ClassType clsDatasource.
Error
An optional string variable that receives the error definition if the connection cannot be established.
Remarks

If the data source is already connected when the method is executed, the method returns True. If the data source is not connected, the method attempts to connect to the data source, returning True if the connection is established or False if the connection cannot be established.

It is not necessary to establish a connection to a data source before it can be used. Decision Support Objects (DSO) will automatically establish the connection when necessary, such as to read a property value from the source database or to access data in the database.

Example

'Assume an object (dsoDS) of ClassType clsDatasource exists

If Not dsoDS.IsConnected Then

   ' Code to handle connection error

Else

   ' Connection is established

End If

(c) 1988-1998 Microsoft Corporation. All Rights Reserved.