Using a transaction to insert into two typed dataset tables

S

Simon

Hi All,

I'm hoping someone could advise me on how to make the following two
operations atomic.

I have a Places table and a PlaceBoundaryPoints table.

When I create a "Place" I need to add a Place row and a number of
PlaceBoundaryPoints (e.g. a place is made up of several boundary points,
which are stored in a seperate table)

I would like the insertion to be atomic.

I have a strongly typed dataset that contains the two datatables - each
has been configured with full select/insert/update/delete commands

Can anyone advise me on how I can share a transaction between the two
operations so that I can commit or rollback as necessary?

Many thanks to anyone who can help

Kindet Regards

Simon
 
N

Nicholas Paldino [.NET/C# MVP]

Simon,

Look at the TransactionScope class in the System.Transactions namespace.
You can create the scope, then call update on the adapters for the two
tables, and then call the Commit method to commit the transaction.
 

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