Transaction Support in Access

R

Rahul

I am using VB.NET 2005 to program a Database Application, with Access 2003 as
the DB backend.
Every now & then, I have to make a series of updates to the tables as a
result of user actions. Either all of these updates should be performed or
none of them should be applied to the database.

ADO.NET provides transactions fo the purpose. So, I create OleDB commands
for each update.
Now, the problem is that when I set the command's Transaction property as:

command.Transaction=tx

and later try to commit or rollback the transaction using,

tx.Commit or
tx.Rollback

It gives me an exception saying that the transaction has already closed.
If I dont commit but simply set the command's transaction property, then
none of the update is applied to the database, even when no exception is
generated.

What is the solution to my problem????
 
G

Graham R Seach

Rahul,

You might be better to use automatic transaction processing.
Imports System.EnterpriseServices

<Transaction(TransactionOption.RequiresNew)> _
Public Class myClass
<AutoComplete(True)> _
Public Sub myProcedure()
..........

Using declarative transaction processing relieves you of the burden of
managing them in code. I'm certainly no DotNet expert, so I recommend you
ask this question in the appropriate VB DotNet newsgroups.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
R

Rahul

Thanx Graham....
I will try the automatic Transaction processing, and will get back here to
communicate whether it worked!!

Anyways, thanx for now...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top