VistaDB 5

ConnectionString Property (VistaDBConnection)
Gets or sets the string used to open the connection. Class VistaDBConnectionClass VistaDBConnectionStringBuilder
Public Overrides NotOverridable Property ConnectionString As System.String
Dim instance As VistaDBConnection
Dim value As System.String
instance.ConnectionString = value
value = instance.ConnectionString
public override System.string ConnectionString {get; set;}
public read-write property ConnectionString: System.String; override; 
public override function get,set ConnectionString : System.String
public: __property System.string* get_ConnectionString() override;
public: __property void set_ConnectionString( 
   System.string* value
) override;
property System.String^ ConnectionString {
   System.String^ get() override;
   void set (    System.String^ value) override;

The following list shows the valid names for keyword values within the ConnectionString.

Parameter Description
Data Source Database file name. You may also use the |DataDirectory| tag (see below)
Open Mode Database open mode. Can be one of the following values: ExclusiveReadWrite, ExclusiveReadOnly, NonexclusiveReadWrite, NonexclusiveReadOnly and SharedReadOnly.
Password String used to build encryption key for encrypt\decrypt database content.
Min Pool Size The minimum number of connections allowed in the pool. Default value is 1.
Pooling Connection Pooling support enabled status. Default is disabled.
Context Connection May be assigned only for CLR stored procedures. If set to true the context connection is used.
Isolated Storage If it is set to true the database placed in isolated storage.
Transaction Mode On, Off, or ignore for how the connection should treat transactions. Default is On.
Compatibility Mode Legacy, Normal, or Strict for how the connection should handle syntax compatibility. Default is Normal

The VistaDBConnectionStringBuilder class provides functionality for creating and managing the contents of connection strings. To simplify managing paths you can use the |DataDirectory| variable. By default, the |DataDirectory| variable will be expanded as follow:

  • For applications placed in a directory on the user machine, this will be the app's (.exe) folder.
  • For apps running under ClickOnce, this will be a special data folder created by ClickOnce
  • For Web apps, this will be the App_Data folder

Under the hood, the value for |DataDirectory| simply comes from a property on the app domain. It is possible to change that value and override the default behavior by doing this:

<code lang="C#"> AppDomain.CurrentDomain.SetData("DataDirectory", newpath) </code>

The following example creates a VistaDBConnection and sets the ConnectionString property before opening the connection.
public VistaDBConnection 
    string connectionString = @"Data Source = C:\VistaDB.vdb5; Open Mode = ExclusiveReadWrite";
    VistaDBConnection connection = new VistaDBConnection(connectionString);
    return connection;

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


VistaDBConnection Class
VistaDBConnection Members
Class VistaDBConnection
Class VistaDBConnectionStringBuilder