Contents Index Close method ConnectionTimeout property

ASA Programming Guide
  Adaptive Server Anywhere .NET Data Provider API Reference
    AsaConnection class

ConnectionString property


Description 

A database connection string.

Syntax 

string ConnectionString

Access 

Read-write

Implements 

IDbConnection.ConnectionString

Usage 

The default value of connection pooling is true (pooling=true).

The ConnectionString is designed to match the Adaptive Server Anywhere connection string format as closely as possble with the following exception:

You can use the ConnectionString property to connect to a variety of data sources.

You can set the ConnectionString property only when the connection is closed. Many of the connection string values have corresponding read-only properties. When the connection string is set, all of these properties are updated, unless an error is detected. If an error is detected, none of the properties are updated. AsaConnection properties return only those settings contained in the ConnectionString.

If you reset the ConnectionString on a closed connection, all connection string values and related properties are reset, including the password.

When the property is set, a preliminary validation of the connection string is performed. When an application calls the Open method, the connection string is fully validated. A runtime exception is generated if the connection string contains invalid or unsupported properties.

Values may be delimited by single or double quotes. Either single or double quotes may be used within a connection string by using the other delimiter, for example, name="value's" or name= 'value"s', but not name='value's' or name= ""value"". Blank characters are ignored unless they are placed within a value or within quotes. Keyword-value pairs must be separated by a semicolon. If a semicolon is part of a value, it must also be delimited by quotes. Escape sequences are not supported, and the value type is irrelevant. Names are not case sensitive. If a property name occurs more than once in the connection string, the value associated with the last occurrence is used.

You should use caution when constructing a connection string based on user input, such as when retrieving a user ID and password from a dialog box, and appending it to the connection string. The application should not allow a user to embed extra connection string parameters in these values.

Example 

The following statements set a connection string for an ODBC data source named ASA 9.0 Sample and open the connection.

AsaConnection conn = new AsaConnection();
conn.ConnectionString = "dsn=ASA 9.0 Sample";
conn.Open();

Contents Index Close method ConnectionTimeout property