OleDbTransaction 类

定义

表示要在数据源进行的 SQL 事务。Represents an SQL transaction to be made at a data source. 无法继承此类。This class cannot be inherited.

public ref class OleDbTransaction sealed : System::Data::Common::DbTransaction
public sealed class OleDbTransaction : System.Data.Common.DbTransaction
type OleDbTransaction = class
    inherit DbTransaction
Public NotInheritable Class OleDbTransaction
Inherits DbTransaction
继承
OleDbTransaction

注解

应用程序通过在 OleDbConnection 对象上调用 BeginTransaction 来创建 OleDbTransaction 对象。The application creates an OleDbTransaction object by calling BeginTransaction on the OleDbConnection object. 与事务关联的所有后续操作(例如,提交或中止事务)都在 OleDbTransaction 对象上执行。All subsequent operations associated with the transaction (for example, committing or aborting the transaction), are performed on the OleDbTransaction object.

属性

Connection

获取与该事务关联的 OleDbConnection 对象,或者如果该事务不再有效,则为 nullGets the OleDbConnection object associated with the transaction, or null if the transaction is no longer valid.

DbConnection

在派生类中重写时,获取与事务关联的 DbConnection 对象。When overridden in a derived class, gets the DbConnection object associated with the transaction.

(继承自 DbTransaction)
IsolationLevel

为该事务指定 IsolationLevelSpecifies the IsolationLevel for this transaction.

方法

Begin()

启动嵌套的数据库事务。Initiates a nested database transaction.

Begin(IsolationLevel)

启动嵌套的数据库事务,并为新事务指定要使用的隔离级别。Initiates a nested database transaction and specifies the isolation level to use for the new transaction.

Commit()

提交数据库事务。Commits the database transaction.

CommitAsync(CancellationToken)

异步提交数据库事务。Asynchronously commits the database transaction.

(继承自 DbTransaction)
CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放 DbTransaction 使用的非托管资源。Releases the unmanaged resources used by the DbTransaction.

(继承自 DbTransaction)
Dispose(Boolean)

释放 DbTransaction 使用的非托管资源,并选择性地释放托管资源。Releases the unmanaged resources used by the DbTransaction and optionally releases the managed resources.

(继承自 DbTransaction)
DisposeAsync()

异步处置事务对象。Asynchronously diposes the transaction object.

(继承自 DbTransaction)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Finalize()

在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
Rollback()

从挂起状态回滚事务。Rolls back a transaction from a pending state.

RollbackAsync(CancellationToken)

从挂起状态异步回滚事务。Asynchronously rolls back a transaction from a pending state.

(继承自 DbTransaction)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

显式接口实现

IDbTransaction.Connection

获取与事务关联的 DbConnection 对象,或空引用(如果该事务不再有效)。Gets the DbConnection object associated with the transaction, or a null reference if the transaction is no longer valid.

(继承自 DbTransaction)
IDisposable.Dispose()

适用于

另请参阅