Do we have transactions in MS-Access?(我们在 MS-Access 中有交易吗?)
问题描述
我正在使用 C#.NET 和 MS-Access 开发一个小型桌面应用程序.我之前没有任何 MS-Access 经验.我想知道我们是否可以在 Ms-Access 中使用事务.
I am developing a small desktop application using C#.NET and MS-Access. I don't have any prior experience of MS-Access. I want to know if we can use transactions in Ms-Access or not.
我有下面提到的情况.
插入到 Tbl1
插入到 Tbl2
Insert in Tbl1
Insert in Tbl2
我只想在 tbl1 中插入成功时才在 tbl2 中插入.如果在tbl2中插入时出现异常,我想回滚tbl1中的插入.
我知道这可以在 sql-server 中轻松实现,但在 ms-access 的情况下,我应该如何管理它.请帮忙,在此先感谢.
I want to insert in tbl2 only when insertion in tbl1 is successful. And if there is some exception during insertion in tbl2, I want to rollback the insertion in tbl1.
I know this can easily be achieved in sql-server, but in case of ms-access, How should I manage this.
Please Help, Thanks in advance.
推荐答案
看起来我们这样做了:MSDN - TRANSACTION 语句 (Microsoft Access SQL)
事务不会自动启动.要启动事务,您必须明确地使用:
Transactions are not started automatically. To start a transaction, you must do so explicitly using:
BEGIN TRANSACTION
通过提交事务期间执行的所有工作来结束事务:
Conclude a transaction by committing all work performed during the transaction:
COMMIT [TRANSACTION | WORK]
通过回滚事务期间执行的所有工作来结束事务:
Conclude a transaction by rolling back all work performed during the transaction:
ROLLBACK [TRANSACTION | WORK]
这篇关于我们在 MS-Access 中有交易吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我们在 MS-Access 中有交易吗?


- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 输入按键事件处理程序 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01