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.
I have the below mentioned situation.
Insert in Tbl1
Insert in Tbl2
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.
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:
Conclude a transaction by committing all work performed during the transaction:
Conclude a transaction by rolling back all work performed during the transaction: