These tutorials demonstrate selected features in ASP.NET version 2.0, but they are compatible with later versions of ASP.NET as well. For the current documentation, see the ASP.NET portal on the MSDN Web site.

 

 

   Welcome   |   ASP.NET   |   Web Services   |   Class Browser   
  |   I want my samples in...      

How Do I...? Common Tasks QuickStart Tutorial

How Do I...Get the outcome of a transaction?

Transaction outcome is handled through events. To receive the outcome of a specific transaction you need to handle the TransactionCompletedEvent event which is on the Transaction object.

Here is an example of how to receive the TransactionCompletedEvent event:

1. Register for the TransactionCompletedEvent for the transaction you want to receive the outcome for

		
	AddHandler MyTx.TransactionCompleted, AddressOf Current_TransactionCompleted
VB

2. Within the handler you can access the outcome of the transaction by looking at the Status property on the TransactionInformation class. This can be accessed from the TransactionEventArgs e, which is a Transaction object.

		
        Public Shared Sub Current_TransactionCompleted(ByVal sender As Object, ByVal e As TransactionEventArgs)
            Console.WriteLine("Status:         {0}", e.Transaction.TransactionInformation.Status)
            Console.WriteLine("ID:             {0}", e.Transaction.TransactionInformation.LocalIdentifier)
        End Sub
VB

Here is a full example:

[This sample can be found at D:\quickstarts.asp.net\QuickStartv20\howto\samples\Transactions\TxOutcome
To build this sample, open the SDK command prompt and navigate to the above path. Build the sample using the build tool msbuild passing the solution file as the first parameter: msbuild mySample.sln. The compiled executable will be found in the sub directory \bin directory.]




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