TypedDatasets and Transaction

G

Guest

Hi

I have a transaction that adds a row in two tables. To accomplish this I have created a coarse grained method, which opens a transaction and then calls two fine grained methods (each responsible for adding a row in the dataset coresponding to a table). Individual methods updates the dataset respectively after adding the rwo to the dataset, to update the database. If there is any exception, the complete transactions rolls backs, so as far as database is concerned, data integrity is maintained, but the datasets still keeps the row for which the operation is successfull. I was wondering, is it possible to rollback all the newly created (or modified or deleted ) rows in the dataset, if the transaction fails which updating the database from the datasets

I would also apreciate if anyone can share how they are handling transaction while working with typed datasets.

Thanks
Paresh
 
M

Miha Markic [MVP C#]

Hi Paresh,

You should be doing database operations on DataSet.GetChanges() dataset
copy.
If changes are successful you should do Merge to the orginal one.

HTH
--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Paresh said:
Hi,

I have a transaction that adds a row in two tables. To accomplish this I
have created a coarse grained method, which opens a transaction and then
calls two fine grained methods (each responsible for adding a row in the
dataset coresponding to a table). Individual methods updates the dataset
respectively after adding the rwo to the dataset, to update the database. If
there is any exception, the complete transactions rolls backs, so as far as
database is concerned, data integrity is maintained, but the datasets still
keeps the row for which the operation is successfull. I was wondering, is it
possible to rollback all the newly created (or modified or deleted ) rows in
the dataset, if the transaction fails which updating the database from the
datasets?
I would also apreciate if anyone can share how they are handling
transaction while working with typed datasets.
 

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