Skip Headers
Oracle® Objects for OLE Developer's Guide
11g Release 2 (11.2) for Microsoft Windows

Part Number E17727-03
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

AutoCommit Property

Applies To

OraDatabase Object

Description

Returns or sets the AutoCommit property of the OraDatabase object.

Usage

autocommit = OraDatabase.AutoCommit
OraDatabase.AutoCommit = [ True | False 

Data Type

Boolean

Remarks

If the AutoCommit property is set to True, all the data operations that modify data in the database are automatically committed after the statement is executed.

If the AutoCommit property is set to False, you need to use the OraDatabase transaction methods (BeginTrans, CommitTrans, and Rollback) or SQL statements to control transactions.

Examples

The following example shows how to control transactions with SQL statements after setting the AutoCommit property to False.

Dim session As OraSession 
Dim MyDb As OraDatabase 
Set OraSession = CreateObject("OracleInProcServer.XOraSession") 
Set MyDb = OraSession.OpenDatabase("ExampleDb", "scott/tiger", 0) 
MyDb.AutoCommit = False 
MyDb.ExecuteSQL ("update emp set sal = 100000" & _ 
                  "where ename = 'JOHN SMITH' ") 
MyDb.ExecuteSQL ("commit")