VistaDB 5
Members  Example 






VistaDB.Provider Namespace : VistaDBConnection Class
VistaDBConnection Class
Represents an open connection to a VistaDB database.
Syntax
'Declaration
 
Public NotInheritable Class VistaDBConnection 
   Inherits System.Data.Common.DbConnection
'Usage
 
Dim instance As VistaDBConnection
public sealed class VistaDBConnection : System.Data.Common.DbConnection 
public class VistaDBConnection = class(System.Data.Common.DbConnection)sealed; 
public sealed class VistaDBConnection extends System.Data.Common.DbConnection
public __gc __sealed class VistaDBConnection : public System.Data.Common.DbConnection 
public ref class VistaDBConnection sealed : public 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