Transactions in .Net

suki_ash

Newcomer
Joined
Feb 22, 2007
Messages
3
Hi

I am a new bie to transactions in .Net. I want to maintain transactions in my code.

Please see the following pseudo code.

public sub update()
{
cmd.Update() 'Update the database

createFiles() 'Update the File server by creating some files

cmd.Insert() 'Insert some records in the database

---------- some more code
}

Now, here i need to maintain the transaction scope in the method update().

Whereever it got a problem in this method, it should be rolled back.

I tried the TransactionScope in .Net framework 2.0 but it seems like not working.

Please suggest me some way to do this.

Thanks in advance,
Subhash.
 
How about using the BeginTransaction method from the Connection object. If your database support transaction then you can handle commit and rollback in your application.

CMIIW.
 
Back
Top