ConnectionString property

Specifies the parameters to use for opening a connection to an UltraLite.NET database. The connection string can be supplied using a ULConnectionParms object.

Syntax
Visual Basic
Public Overrides Property ConnectionString As String
C#
public override string  ConnectionString { get; set; }
Property value

The parameters used to open this connection in the form of a semicolon-separated list of keyword-value pairs. The default is an empty string (an invalid connection string).

Remarks

UL Ext.: The parameters used by UltraLite.NET are specific to UltraLite databases and therefore the connection string is not compatible with SQL Anywhere connection strings. For a list of parameters, see UltraLite connection parameters.

Parameter values can be quoted with either single quote (') characters or double quote (") characters provided that the quoted contents do not contain quote characters of the same type. Values must be quoted if they contain semi-colons (;), begin with a quote, or require leading or trailing whitespace.

If you are not quoting parameter values, make sure that they do not contain semi-colons (;), and that they begin with either a single quote (') or a double quote (") character. Leading and trailing spaces in values are ignored.

By default, connections are opened with UID=DBA and PWD=sql. To make the database more secure, change the user DBA's password or create new users (using GrantConnectTo) and remove the DBA user (using RevokeConnectFrom).

Example

The following code creates and opens a connection to the existing database \UltraLite\MyDatabase.udb on a Windows Mobile device.

' Visual Basic
Dim openParms As ULConnectionParms = New ULConnectionParms
openParms.DatabaseOnCE = "\UltraLite\MyDatabase.udb"
Dim conn As ULConnection = New ULConnection
conn.ConnectionString = openParms.ToString()
conn.Open()

// C#
ULConnectionParms openParms = new ULConnectionParms();
openParms.DatabaseOnCE = @"\UltraLite\MyDatabase.udb";
ULConnection conn = new ULConnection();
conn.ConnectionString = openParms.ToString();
conn.Open();
See also