Compartir a través de


@TRANSACTION

You can use the @TRANSACTION processing directive to indicate that the script should be treated as a transaction. If a script is treated as a transaction, Component Services creates a transaction to coordinate the updating of resources.

Syntax

<%@ TRANSACTION = value %>

Parameters

  • Value
    A string that indicates the type of transaction support. Possible values include the following:

    Value

    Meaning

    Required

    Always participates in a transaction, and initiates a transaction if one does not currently exist.

    Requires_New

    Always initiates a new transaction.

    Supported

    Participates in a transaction if one exists but does not require a transaction.

    Not_Supported

    Never participates in a transaction. If called from a script that is using transactions, the script containing the @TRANSACTION processing directive still runs but outside of the context of the transation.

Remarks

If a script contains the @TRANSACTION directive, it must be the very first line in the .asp file, otherwise an error is generated. You must add the directive to each page that should be run under a transaction. The current transaction ends when the script finishes processing.

If the script containing the @TRANSACTION directive has been called by either the Server.Transfer or Server.Execute method, and the value is specified as Required, the script continues the transaction of the calling ASP page, if the calling ASP page was transacted. If the calling ASP page was not transacted, the called ASP page creates a new transaction.

For example, the following two scripts would be considered one transaction:

<%@ TRANSACTION=Required %> 
<% 
  Server.Transfer("/asp/asp2.asp") 
%> 
ASP2 
<%@ TRANSACTION=Required%> 
<% 
  Server.CreateObject("Mytransactedcomponent.Closeout") 
%> 

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also