OpenMode Property

Syntax:

public string OpenMode{ get; set; }

Description:

Type: System.String

Gets or sets the open mode of the connection. The open mode controls the way that database will get open for the connection. Options are "s" for shared mode (the default), "x" for exclusive mode, "xn" for exclusive, no-transaction mode, and "r" for read-only mode.

This property can only be changed when the connection is closed. If the connection is open, attempting to change this value will generate an ArgumentException.

Setting the ConnectionString will override the current value of this property with the open mode specified in the connection string, or by the default if none is specified.

Exceptions:

Exception Condition
ArgumentException The value specified is not valid (i.e. not one of the listed modes).