Version

TestConnection(Exception,Boolean) Method

Returns a boolean value indicating whether the Connection is currently valid.
Syntax
'Declaration
 
Public Overloads Function TestConnection( _
   ByRef exception As Exception, _
   Optional ByVal keepOpen As Boolean _
) As Boolean
public bool TestConnection( 
   out Exception exception,
   bool keepOpen
)

Parameters

exception
[out] Upon return, contains a reference to the exception that resulted from attempting to open the connection. If the connection succeeded, this value is null.
keepOpen
Optional boolean value indicating whether the connection, if successful, should be kept open. By default, the connection is immediately closed.

Return Value

A boolean value indicating whether the connection succeeded.
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also