Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » UltraLite - .NET 编程 » UltraLite .NET 2.0 API 参考 » ULConnection 类 » BeginTransaction 方法

 

BeginTransaction() 方法

返回事务对象。将与事务对象关联的命令作为单个事务执行。使用 ULTransaction.Commit 或 ULTransaction.Rollback 终止事务。

语法
Visual Basic
Public Function BeginTransaction() As ULTransaction
C#
public ULTransaction BeginTransaction();
返回值

一个表示新事务的 ULTransaction 对象。

注释

使用 IsolationLevel.ReadCommitted 创建事务。

要将命令与事务对象相关联,请使用 ULCommand.Transaction 属性。当前事务会自动与 ULConnection.CreateCommand 所创建的命令相关联。

缺省情况下,连接不使用事务,且所有命令均会在执行时自动提交。提交或回退当前事务后,连接即会恢复为自动提交模式和前一个隔离级别,直至下一次调用 BeginTransaction。

与 ADO.NET 的 IsolationLevel 文档相比,UltraLite 的每个隔离级别定义稍有不同。有关详细信息,请参见UltraLite 隔离级别

这是 System.Data.IDbConnection.BeginTransaction() 和 System.Data.Common.DbConnection.BeginTransaction() 的强类型版本。

另请参见