VistaDB 6
VistaDB.Provider Namespace / VistaDBConnection Class
Members Example


In This Topic
    VistaDBConnection Class
    In This Topic
    Represents an open connection to a VistaDB database.
    Syntax
    'Declaration
     
    
    <System.ComponentModel.DesignerCategoryAttribute("Component")>
    Public NotInheritable Class VistaDBConnection 
       Inherits System.Data.Common.DbConnection
    'Usage
     
    
    Dim instance As VistaDBConnection
    [System.ComponentModel.DesignerCategory("Component")]
    public sealed class VistaDBConnection : System.Data.Common.DbConnection 
    Remarks

    By default connection pools will be utilized to speed up connection open timings.

    As with most database systems, it's recommended that a VistaDB database connection be closed as soon as you're done with it. It's generally better to close and reopen connections than to hold on to them when you aren't actively using them. This maximizes the performance of other threads or processes that may want to access the database.

    To ensure all resources are released in a timely maner it's recommended that you Dispose the connection object as you close it. The Using pattern is often the best way to achieve this as it ensures that even in the event of an exception or early return from your method the connection will be disposed. The using pattern is demonstrated in the example below.

    Do not place the Dispose() or Close() calls 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, and possibly pinning the connection object in memory. Dispose calls effectively also Closes the connection.

    Example
    using( VistaDB.Provider.VistaDBConnection connection =
      new VistaDB.Provider.VistaDBConnection("Data Source=" + dbName)
     )
    {
        connection.Open();
        // Do some work...
    }
    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          System.ComponentModel.Component
             System.Data.Common.DbConnection
                VistaDB.Provider.VistaDBConnection

    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