AutoCommit Property


public bool AutoCommit { get; set; }


Type: System.Boolean

Gets or sets the auto commit mode of the connection. The auto commit mode determines whether a transaction has to be started explicitly or not. If auto commit is on then each executed statement will automatically start and end a transaction if an existing transaction is not already started. Explicit transactions can still be created but are not required. If auto commit is not on then transactions must be explicitly started and ended.

While auto commit is a nice convenience, most serious database applications will want to disable this mode so that changes that are related will all occur within a single transaction. This way they will either all be committed or none will.

The default connection has auto commit mode enabled.

This property can be changed when the connection is open or closed. If the connection is open, attempting to enable auto commit mode while in the middle of an existing transaction will generate an exception. Changing this property when the connection is closed will cause the next open to use the specified method.

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


Exception Condition
RdmException A transaction was already in progress when auto commit was disabled