VistaDB 6
VistaDB.Provider Namespace / VistaDBConnection Class / VistaDBConnection Constructor / VistaDBConnection Constructor(String)
The connection used to open the VistaDB database.
Example


In This Topic
    VistaDBConnection Constructor(String)
    In This Topic
    Initializes a new instance of the VistaDBConnection class when given a string that contains the connection string.

    It is considered a best practice to close the connection as soon as you are finished with it. Do NOT place the .Close() call in a Finalizer or object destructor. Both of those are non-deterministic (you cannot predict when or if they will be called). This leads to connection handle leaks over the lifetime of an application.

    Syntax
    'Declaration
     
    
    Public Function New( _
       ByVal connectionString As System.String _
    )
    'Usage
     
    
    Dim connectionString As System.String
     
    Dim instance As New VistaDBConnection(connectionString)
    public VistaDBConnection( 
       System.string connectionString
    )

    Parameters

    connectionString
    The connection used to open the VistaDB database.
    Remarks

    If you have a connection with connection pooling enabled and you wish to close all of them call the static function VistaDBConnection.ClearAllPools();

    To clear a single pool instance you call the static function VistaDBConnection.ClearPool( myConnection ); Where myConnection is a properly initialized VistaDBConnection object.

    Example
    The following example creates and opens a VistaDBConnection.

    If you have a connection with connection pooling enabled and you wish to close all of them call the static function VistaDBConnection.ClearAllPools();

    To clear a single pool instance you call the static function VistaDBConnection.ClearPool( myConnection ); Where myConnection is a properly initialized VistaDBConnection object.

    public VistaDBConnection OpenConnection(string connectionString)
    {
    	VistaDBConnection connection = new VistaDBConnection(connectionString);
    	connection.Open();
    	return connection;
    }
    Requirements

    Target Platforms: 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