Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

ADO BeginTrans、CommitTransRollbackTrans 方法


❮ 连接对象完整参考

这三个方法与 Connection 对象一起使用,用于保存或取消对数据源所做的更改。

注意:并非所有提供程序都支持事务。

注意:这三个方法在客户端 Connection 对象上不可用。

BeginTrans

BeginTrans 方法启动一个新的事务。

此方法还可以用于返回一个长整型值,表示嵌套事务的级别。顶级事务的返回值为 1。每个额外的级别递增 1。

CommitTrans

CommitTrans 方法保存自上次 BeginTrans 方法调用以来所做的所有更改,并结束当前事务。

由于事务可以嵌套,因此必须先解决所有低级事务,才能解决高级事务。

RollbackTrans

RollbackTrans 方法取消自上次 BeginTrans 方法调用以来所做的所有更改,并结束事务。

由于事务可以嵌套,因此必须先解决所有低级事务,才能解决高级事务。

语法

level=objconn.BeginTrans()

objconn.BeginTrans

objconn.CommitTrans

objconn.RollbackTrans

❮ 连接对象完整参考
×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.