我们有在MS接入交易?MS

由网友(Zai坚强一点)分享简介:我正在开发一个小的桌面应用程序中使用的 C#.NET和MS-访问。我没有的MS-访问任何以前的经验。我想知道,如果我们可以使用MS-访问交易与否。I am developing a small desktop application using C#.NET and MS-Access. I don't have a...

我正在开发一个小的桌面应用程序中使用的 C#.NET和MS-访问。我没有的MS-访问任何以前的经验。我想知道,如果我们可以使用MS-访问交易与否。

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.

我有以下提到的情况。

插入TBL 1 插入TBL2

Insert in Tbl1 Insert in Tbl2

我想tbl2的插入,只有当插入TBL 1成功。如果有插入tbl2的过程中有些异常,我想回滚在TBL 1插入。 我知道这很容易在SQL服务器来实现,但有MS-访问,我该怎么办这个。 请大家帮忙,先谢谢了。

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)

It looks like we do: MSDN - TRANSACTION Statement (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]
阅读全文

相关推荐

最新文章