ULConnectionStringBuilder class

Builds a connection string for opening a connection to an UltraLite database. The frequently-used connection parameters are individual properties on the ULConnectionStringBuilder object. This class cannot be inherited.

Syntax
Visual Basic
Public NotInheritable Class ULConnectionStringBuilder
  Inherits DbConnectionStringBuilder
C#
public sealed class ULConnectionStringBuilder: DbConnectionstring Builder
Remarks

Restrictions: The ULConnectionStringBuilder class is not available in the .NET Compact Framework 2.0.

A ULConnectionStringBuilder object is used to specify the parameters for opening a connection (ULConnection.Open) or dropping a database (ULDatabaseManager.DropDatabase).

Leading and trailing spaces are ignored in all values. Values must not contain leading or trailing spaces, or a semicolon (;), or begin with either a single quote (') or a double quote (").

When building a connection string, you need to identify the database and specify any optional connection settings. Once you have supplied all the connection parameters by setting the appropriate properties on a ULConnectionStringBuilder object, you create a connection string using the System.Data.Common.DbConnectionStringBuilder.ConnectionString. The resulting string is used to create a new ULConnection with the ULConnection(String) constructor or set the ULConnection.ConnectionString of an existing ULConnection object.

Identifying the database

Each instance contains platform-specific paths to the database. Only the value corresponding to the executing platform is used. For example, in the code below the path \UltraLite\mydb1.udb would be used on Windows Mobile, while mydb2.db would be used on other platforms.

' Visual Basic
Dim dbName As ULConnectionStringBuilder = _
  new ULConnectionStringBuilder
dbName.DatabaseOnCE = "\UltraLite\mydb1.udb"
dbName.DatabaseOnDesktop = "somedir\mydb2.udb"

// C#
ULConnectionStringBuilder dbName = new ULConnectionStringBuilder();
dbName.DatabaseOnCE = "\\UltraLite\\mydb1.udb";
dbName.DatabaseOnDesktop = @"somedir\mydb2.udb";

The recommended extension for UltraLite database files is .udb. On Windows Mobile devices, the default database is \UltraLiteDB\ulstore.udb. On other Windows platforms, the default database is ulstore.udb. In C#, you must escape any backslash characters in paths or use @-quoted string literals.

If you are using multiple databases, you must specify a database name for each database. For more information, see DatabaseName property.

Optional connection settings

Depending on your application's needs and how the database was created, you might need to supply a non-default ULConnectionStringBuilder.UserID and ULConnectionStringBuilder.Password, a database ULConnectionStringBuilder.DatabaseKey, and the connection ULConnectionStringBuilder.CacheSize. If your application is using multiple connections, you should provide a unique ULConnectionStringBuilder.ConnectionName for each connection.

Databases are created with a single authenticated user, DBA, whose initial password is sql. By default, connections are opened using the user ID DBA and password sql. To disable the default user, use the ULConnection.RevokeConnectFrom. To add a user or change a user's password, use the ULConnection.GrantConnectTo.

If an encryption key was supplied when the database was created, all subsequent connections to the database must use the same encryption key. To change a database's encryption key, use the ULConnection.ChangeEncryptionKey.

For more information, see UltraLite connection parameters.

See also

ULConnectionStringBuilder members
ULConnectionStringBuilder constructors
CacheSize property
ConnectionName property
DatabaseKey property
DatabaseName property
DatabaseOnCE property
DatabaseOnDesktop property
Item property
OrderedTableScans property
Password property
ReserveSize property
StartLine property
UserID property
ContainsKey method
EquivalentTo method
GetShortName method
Remove method
TryGetValue method