Transactions under ADO.NET 1.1

S

Simon Hart

Hi,

I have a relatively simple question. I am doing a batch process which
consits of reading a table then maybe writing and updating etc. The whole
process works like this:

Open SqlConnection
Create a SqlTransaction object and call BeginTransaction on the
SqlConnection object
Write to a table
Read a table uisng DataAdapter -- Does not allow me to do this.
Update a table
Close SqlConnection.

If the above process complets then I want to Commit the transaction, if it
fails then I want to Rollback the changes.
The above process is fairly hairy and the writing and updating is based on
various reads. But ADO.NET does not seem to allow me to read a table after
calling BeginTransaction on the SqlConnection object?

I am using OleDb provider because I am doing the above on a Microsoft Access
2000 database.

Any ideas on how to get around this will be great. Of course I could split
it up but this will be hard to code as I need to read tables in the middle
of the transaction.

Regards
Simon.
 
S

Simon Hart

It's OK, I have having I think as s*it day. Simply using the
DataAdpater.SelectCommand, UpdateCommand or DeleteCommand's Transaction
property achives the desired result.

Simon.
 

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