Home   |   QuickStart Welcome   |   ASP.NET   |   Web Services   |   How Do I...?   
  |   I want my samples in...      

How Do I...? Common Tasks QuickStart Tutorial

How can I use Transactions in my code?



The�SimpleTx sample demonstrates how to create a simple transaction. This sample creates a transaction instance with the using statement and TransactionsScope which is disposable. No actual transacted work will be done, but the user can choose to commit or abort this empty transaction after it is created.
		

	class SimpleTx
	{
		static void Main(string[] args)
		{
			using (TransactionScope scope = new TransactionScope ())
			{
				// To commmit set scope.Consistent = true;
				scope.Consistent = true;
				...
            }
        }
    }

C#


The following examples shows how to create a simple transaction with the using statement and TransactioScope. No Source or Sample to display.


Microsoft .NET Framework SDK QuickStart Tutorials Version 2.0
Copyright � 2004 Microsoft Corporation. All rights reserved.